Using git:
$ git clone https://github.com/seeschloss/floreal.git
Using npm:
$ npm install floreal
Uses the native JavaScript Date object to parse timespec and takes any correctly formatted date. An undefined
timespec means today.
var Floreal = require('floreal').Date;
var coup = new Floreal("1799-11-09");
console.log('%s', coup);
will output:
18 brumaire, an VIII
Returns the full date in long form as "[day number] [month name], an [year in roman numerals]"
var Floreal = require('floreal').Date;
console.log('%s', (new Floreal("1799-10-11")).toFullDateString());
will output:
18 brumaire, an VIII
Returns the full date in short form as "[day number]-[month number]-[year in roman numerals]"
var Floreal = require('floreal').Date;
console.log('%s', (new Floreal("1799-10-11")).toShortDateString());
will output:
18-02-VIII
Sets Republican year for the date in roman numerals
Sets Republican year for the date in arabic numerals
Sets Republican month for the date. Month 1 is vendémiaire, both 0 and 13 represent complementary days.
Sets Republican day for the date, first day of the month is 1.
Sets the full Republican date.
var Floreal = require('floreal').Date;
var date = new Floreal();
date.setDate(8, 2, 18);
console.log('%s', date.toFullDateString());
will output:
18 brumaire, an VIII
Displays year of the Republic as roman numerals or as a decimal number
var Floreal = require('floreal').Date;
var coup = new Floreal("1799-11-09");
console.log('%s', coup.year());
console.log('%s', coup.yearDecimal());
will output:
VIII
8
Returns true if year is sextile, using actual sextile years for years I to XVI, and Romme system for subsequent years.
var Floreal = require('floreal').Date;
console.log('%s', (new Floreal("1799-11-09")).isYearSextile());
console.log('%s', (new Floreal("1803-08-18")).isYearSextile());
will output:
false
true
Returns the first day of the Republican year as a JavaScript Date object.
var Floreal = require('floreal').Date;
console.log('%s', (new Floreal("1799-11-09")).firstDayOfYear().toDateString());
console.log('%s', (new Floreal("1803-08-18")).firstDayOfYear().toDateString());
will output:
Mon Sep 23 1799
Thu Sep 23 1802
Returns the day number within the year (from 1 to 365, or 366 for sextile years).
var Floreal = require('floreal').Date;
console.log('%s', (new Floreal("1799-11-09")).dayOfYear());
will output:
48
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 = require('floreal').Date;
console.log('%s', (new Floreal("1799-11-09")).month());
will output:
2
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 = require('floreal').Date;
console.log('%s', (new Floreal("1800-09-20")).isComplementaryDay());
will output:
true
Returns the (French) name of the month, in all lower case, or an empty string for complementary days.
var Floreal = require('floreal').Date;
console.log('"%s"', (new Floreal("1799-11-09")).monthName());
console.log('"%s"', (new Floreal("1800-09-20")).monthName());
will output:
"brumaire"
""
Returns the day number within its month, from 1 to 30 (1 to 6 for complementary days).
var Floreal = require('floreal').Date;
console.log('%s', (new Floreal("1799-11-09")).dayOfMonth());
console.log('%s', (new Floreal("1800-09-20")).dayOfMonth());
will output:
18
3
Returns the day number within its decade, from 1 to 10 (1 to 6 for complementary days).
var Floreal = require('floreal').Date;
console.log('%s', (new Floreal("1799-11-09")).dayOfDecade());
console.log('%s', (new Floreal("1800-09-20")).dayOfDecade());
will output:
8
3
Returns the decade number within the month, from 1 to 3 (complementary days are reported as belonging to first decade).
var Floreal = require('floreal').Date;
console.log('%s', (new Floreal("1799-11-09")).decade());
console.log('%s', (new Floreal("1800-09-20")).decade());
will output:
2
1
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 = require('floreal').Date;
console.log('%s', (new Floreal("1799-11-09")).dayName());
will output:
octidi
Returns the French name of the object associated with the day (like saints on Christian calendars).
var Floreal = require('floreal').Date;
console.log('%s', (new Floreal("1799-10-11")).dayTitle());
will output:
tournesol