Class FrenchRepublicanCalendar

All Implemented Interfaces:
Serializable, Comparable<FrenchRepublicanCalendar>, CalendarDate, ChronoDisplay, Temporal<CalendarDate>

@CalendarType("frenchrev") public final class FrenchRepublicanCalendar extends Calendrical<FrenchRepublicanCalendar.Unit,​FrenchRepublicanCalendar>

Represents the calendar used in French Revolution between 1792 and 1805.

Its design is radically different from standard year-month-day-calendars like the gregorian one. The year started at autumnal equinox at the longitude of Paris observatory and was divided into 12 months with the constant length of 30 days. In order to complete the revolution of the earth around the sun, 5 or 6 complementary days were added after the last month. These complementary days are not part of any month and were sometimes also called "Sansculottides". The sixth complementary day only happened in leap years depending on which day the autumnal equinox of next year started, usually every fourth year.

Napoléon abolished the calendar with begin of gregorian year 1806. Interestingly, the Paris Commune of 1871 reintroduced it for 18 days until its militarian destruction.

This calendar had originally no seven-day-week. Instead the months were divided each into three decades of 10 days, and the 10th day was considered as day of rest - like Sunday in the gregorian calendar. However, Time4J makes both the decade design and the standard seven-day-week available, last one mainly for comparison purposes and especially after April 1802 when the calendar abandoned the original decade system. More calendar details see also Wikipedia.

Following elements which are declared as constants are registered by this class:

Furthermore, all elements defined in EpochDays are supported.

Formatting and parsing: When using format patterns the dynamic pattern type is strongly recommended instead of CLDR-like pattern types because this calendar is structurally different from month-based calendars. Following symbol-element table holds:

Mapping of dynamic pattern symbols
elementsymboltype
ERAGtext
YEAR_OF_ERAy/Ynumber
MONTH_OF_YEARm/Mnumber/text
SANSCULOTTIDESs/Stext
DAY_OF_MONTHd/Dnumber
DAY_OF_DECADEc/Ctext
DAY_OF_WEEKEtext

Note: The standalone form of some enums like the republican month can be printed in a capitalized way if the formatter is first constructed on builder level by using a sectional attribute for the output context. Alternatively, users can simply modify the formatter by calling f.with(Attributes.OUTPUT_CONTEXT, OutputContext.STANDALONE).

Furthermore: The abbreviated form of the republican month is usually numeric with two arabic digits. For more control about the numeric representation, the builder offers extra fine-tuned methods.

It is strongly recommended to use the or-operator "|" in format patterns because not every date of this calendar has a month. Example:

    ChronoFormatter<FrenchRepublicanCalendar> f =
      ChronoFormatter.ofPattern(
        "[D. MMMM|SSSS]', an 'Y",
        PatternType.DYNAMIC,
        Locale.FRENCH,
        FrenchRepublicanCalendar.axis());

    FrenchRepublicanCalendar cal = PlainDate.of(2018, 9, 23).transform(FrenchRepublicanCalendar.axis());
    System.out.println(f.format(cal)); // output => 1. vendémiaire, an CCXXVII

    cal = cal.minus(CalendarDays.ONE);
    System.out.println(f.format(cal)); // output => jour de la révolution, an CCXXVI
 
Since:
3.33/4.28
Author:
Meno Hochschild
See Also:
FrenchRepublicanEra, FrenchRepublicanMonth, Sansculottides, DayOfDecade, Serialized Form
  • Field Details

  • Method Details

    • of

      public static FrenchRepublicanCalendar of(int year, FrenchRepublicanMonth month, int dayOfMonth)

      Creates a new instance of a French republican date.

      Parameters:
      year - republican year in range 1-1202
      month - republican month as enum
      dayOfMonth - day of month in range 1-30
      Returns:
      new instance of FrenchRepublicanCalendar
      Throws:
      IllegalArgumentException - in case of any inconsistencies
    • of

      public static FrenchRepublicanCalendar of(int year, int month, int dayOfMonth)

      Creates a new instance of a French republican date.

      Parameters:
      year - republican year in range 1-1202
      month - republican month in range 1-12
      dayOfMonth - day of month in range 1-30
      Returns:
      new instance of FrenchRepublicanCalendar
      Throws:
      IllegalArgumentException - in case of any inconsistencies
    • of

      public static FrenchRepublicanCalendar of(int year, Sansculottides sansculottides)

      Creates a new instance of a French republican date as complementary day.

      Parameters:
      year - republican year in range 1-1202
      sansculottides - the complementary day
      Returns:
      new instance of FrenchRepublicanCalendar
      Throws:
      IllegalArgumentException - in case of any inconsistencies
    • nowInSystemTime

      public static FrenchRepublicanCalendar nowInSystemTime()

      Obtains the current calendar date in system time.

      Convenient short-cut for: SystemClock.inLocalView().now(FrenchRepublicanCalendar.axis()).

      Returns:
      current calendar date in system time zone using the system clock
      See Also:
      SystemClock.inLocalView(), ZonalClock.now(Chronology)
    • getEra

      public FrenchRepublicanEra getEra()

      Yields the republican era.

      Returns:
      FrenchRepublicanEra.REPUBLICAN
    • getYear

      public int getYear()

      Yields the republican year.

      Returns:
      int
    • getMonth

      public FrenchRepublicanMonth getMonth()

      Yields the republican month if available.

      Returns:
      month enum
      Throws:
      ChronoException - if this date is a complementary day
      See Also:
      MONTH_OF_YEAR, hasSansculottides(), hasMonth()
    • getDecade

      public int getDecade()

      Yields the decade of current republican month if available.

      Returns:
      int (1, 2 or 3)
      Throws:
      ChronoException - if this date is a complementary day
      See Also:
      DECADE_OF_MONTH, hasSansculottides(), hasMonth()
    • getDayOfMonth

      public int getDayOfMonth()

      Yields the day of month if available.

      Returns:
      int (1-30)
      Throws:
      ChronoException - if this date is a complementary day
      See Also:
      DAY_OF_MONTH, hasSansculottides(), hasMonth()
    • getDayOfDecade

      public DayOfDecade getDayOfDecade()

      Yields the day of decade if available (ten-day-week).

      Returns:
      enum
      Throws:
      ChronoException - if this date is a complementary day
      See Also:
      DAY_OF_DECADE, hasSansculottides(), hasMonth()
    • getDayOfWeek

      public Weekday getDayOfWeek()

      Determines the day of standard-week (with seven days).

      Returns:
      Weekday
    • getDayOfYear

      public int getDayOfYear()

      Yields the day of year.

      Returns:
      int
    • getSansculottides

      public Sansculottides getSansculottides()

      Yields the complementary day if available.

      Returns:
      Sansculottides enum
      Throws:
      ChronoException - if this date is not a complementary day
      See Also:
      hasSansculottides(), hasMonth()
    • hasSansculottides

      public boolean hasSansculottides()

      Is this date a complementary day?

      A date in the French revolutionary calendar has either a month or is a complementary day.

      Returns:
      boolean
      See Also:
      hasMonth(), MONTH_OF_YEAR, DAY_OF_MONTH, DECADE_OF_MONTH, DAY_OF_DECADE, SANSCULOTTIDES
    • hasMonth

      public boolean hasMonth()

      Does this date contain a month?

      A date in the French revolutionary calendar has either a month or is a complementary day.

      Returns:
      boolean
      See Also:
      hasSansculottides(), MONTH_OF_YEAR, DAY_OF_MONTH, DECADE_OF_MONTH, DAY_OF_DECADE, SANSCULOTTIDES
    • isLeapYear

      public boolean isLeapYear()

      Is the year of this date a leap year?

      Returns:
      boolean
    • isLeapYear

      public static boolean isLeapYear(int year)

      Is given republican year a leap year?

      Parameters:
      year - republican year to be checked (in range 1-1202)
      Returns:
      boolean
    • isValid

      public static boolean isValid(int year, int month, int dayOfMonth)

      Queries if given parameter values form a well defined calendar date.

      Parameters:
      year - the year of era to be checked
      month - the month to be checked
      dayOfMonth - the day of month to be checked
      Returns:
      true if valid else false
      Since:
      3.34/4.29
      See Also:
      of(int, int, int)
    • getDate

      Obtains an alternative date view specific for given algorithm.

      Parameters:
      algorithm - calendar computation
      Returns:
      French republican date (possibly modified)
      Throws:
      IllegalArgumentException - in case of date overflow
      Since:
      3.33/4.28
    • at

      Creates a new local timestamp with this date and given wall time.

      If the time T24:00 is used then the resulting timestamp will automatically be normalized such that the timestamp will contain the following day instead.

      Parameters:
      time - wall time
      Returns:
      general timestamp as composition of this date and given time
    • atTime

      public GeneralTimestamp<FrenchRepublicanCalendar> atTime(int hour, int minute)

      Is equivalent to at(PlainTime.of(hour, minute)).

      Parameters:
      hour - hour of day in range (0-24)
      minute - minute of hour in range (0-59)
      Returns:
      general timestamp as composition of this date and given time
      Throws:
      IllegalArgumentException - if any argument is out of range
    • withEndOfFranciade

      public FrenchRepublicanCalendar withEndOfFranciade()

      Obtains the next leap day when the franciade ends.

      Returns:
      end of franciade
      See Also:
      Sansculottides.LEAP_DAY
    • equals

      public boolean equals(Object obj)
      Description copied from class: Calendrical

      Based on the epoch day number and the calendar system.

      In other words: Two date object are equal if they have the same temporal position on the local timeline and have the same calendrical type. Subclasses which define further state attributes must override this method.

      If an only temporal comparison is required then the method Calendrical.isSimultaneous(CalendarDate) is to be used.

      Overrides:
      equals in class Calendrical<FrenchRepublicanCalendar.Unit,​FrenchRepublicanCalendar>
      See Also:
      Chronology.getChronoType()
    • hashCode

      public int hashCode()
      Description copied from class: Calendrical

      Based on the epoch day number.

      Overrides:
      hashCode in class Calendrical<FrenchRepublicanCalendar.Unit,​FrenchRepublicanCalendar>
    • toString

      public String toString()
      Description copied from class: TimePoint

      Provides a complete textual representation of the state of this time point.

      The textual description often follows the conventions of ISO-8601. Usually the description starts with the chronological informations which are coarse-grained and ends with those ones which are fine-grained (for example the ISO-notation YYYY-MM-DD).

      Specified by:
      toString in class TimePoint<FrenchRepublicanCalendar.Unit,​FrenchRepublicanCalendar>
    • contains

      public boolean contains(ChronoElement<?> element)
      Description copied from interface: ChronoDisplay

      Queries if the value for given chronological element can be accessed via get(element).

      If the argument is missing then this method will yield false. Note: Elements which are not registered but define a suitable rule are also accessible.

      Specified by:
      contains in interface ChronoDisplay
      Overrides:
      contains in class ChronoEntity<FrenchRepublicanCalendar>
      Parameters:
      element - chronological element to be asked (optional)
      Returns:
      true if the element is registered or there is an element rule for evaluating the value else false
      See Also:
      ChronoDisplay.get(ChronoElement)
    • isValid

      public <V> boolean isValid(ChronoElement<V> element, V value)
      Description copied from class: ChronoEntity

      Tests if the value for given chronological value is invalid.

      Notes: This method tests if given value to be in question can be set via the expression with(element, value). A numerical overflow situation (causing an ArithmeticException) will usually not be checked.

      Overrides:
      isValid in class ChronoEntity<FrenchRepublicanCalendar>
      Type Parameters:
      V - generic type of element value
      Parameters:
      element - element the given value shall be assigned to
      value - candidate value to be validated (optional)
      Returns:
      true if the method with() can be called without exception else false
      See Also:
      with(ChronoElement, V)
    • axis

      Returns the associated time axis.

      Returns:
      chronology