floreal
Installation
Using git:
$ git clone https://github.com/seeschloss/floreal.git
Using npm:
$ npm install floreal
Usage
new floreal.Date(timespec)
Uses the native JavaScript Date object to parse timespec and takes any correctly formatted date. An undefined
timespec means today.
var Floreal = Date;var coup = "1799-11-09";console;
will output:
18 brumaire, an VIII
floreal.Date.toFullDateString()
Returns the full date in long form as "[day number] [month name], an [year in roman numerals]"
var Floreal = Date;console;
will output:
18 brumaire, an VIII
floreal.Date.toShortDateString()
Returns the full date in short form as "[day number]-[month number]-[year in roman numerals]"
var Floreal = Date;console;
will output:
18-02-VIII
floreal.Date.setYear(year)
Sets Republican year for the date in roman numerals
floreal.Date.setYearDecimal(year)
Sets Republican year for the date in arabic numerals
floreal.Date.setMonth(month)
Sets Republican month for the date. Month 1 is vendémiaire, both 0 and 13 represent complementary days.
floreal.Date.setDay(day)
Sets Republican day for the date, first day of the month is 1.
floreal.Date.setDate(year, month, day)
Sets the full Republican date.
var Floreal = Date;var date = ;date;console;
will output:
18 brumaire, an VIII
floreal.Date.setMonth(month)
floreal.Date.setDay(day)
floreal.Date.year()
floreal.Date.yearDecimal()
Displays year of the Republic as roman numerals or as a decimal number
var Floreal = Date;var coup = "1799-11-09";console;console;
will output:
VIII
8
floreal.Date.isYearSextile()
Returns true if year is sextile, using actual sextile years for years I to XVI, and Romme system for subsequent years.
var Floreal = Date;console;console;
will output:
false
true
floreal.Date.firstDayOfYear()
Returns the first day of the Republican year as a JavaScript Date object.
var Floreal = Date;console;console;
will output:
Mon Sep 23 1799
Thu Sep 23 1802
floreal.Date.dayOfYear()
Returns the day number within the year (from 1 to 365, or 366 for sextile years).
var Floreal = Date;console;
will output:
48
floreal.Date.month()
Returns the month number within the year. Complementary days are technically not part of any month, but for practical purposes are considered part of the 13th month.
var Floreal = Date;console;
will output:
2
floreal.Date.isComplementaryDay()
Whether the day is a complementary day—the five or six days at the end of the year which are not part of any month.
var Floreal = Date;console;
will output:
true
floreal.Date.monthName()
Returns the (French) name of the month, in all lower case, or an empty string for complementary days.
var Floreal = Date;console;console;
will output:
"brumaire"
""
floreal.Date.dayOfMonth()
floreal.Date.day()
Returns the day number within its month, from 1 to 30 (1 to 6 for complementary days).
var Floreal = Date;console;console;
will output:
18
3
floreal.Date.dayOfDecade()
floreal.Date.dayOfWeek()
Returns the day number within its decade, from 1 to 10 (1 to 6 for complementary days).
var Floreal = Date;console;console;
will output:
8
3
floreal.Date.decade()
Returns the decade number within the month, from 1 to 3 (complementary days are reported as belonging to first decade).
var Floreal = Date;console;console;
will output:
2
1
floreal.Date.dayName()
Returns the name of the day (primidi, duodi... equivalent to monday, tuesday...). Complementary days have a different naming scheme and are named "jour de la vertu", "jour du génie", etc.
var Floreal = Date;console;
will output:
octidi
floreal.Date.dayTitle()
Returns the French name of the object associated with the day (like saints on Christian calendars).
var Floreal = Date;console;
will output:
tournesol