floreal
DefinitelyTyped icon, indicating that this package has TypeScript declarations provided by the separate @types/floreal package

1.1.1 • Public • Published

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 = require('floreal').Date;
var coup = new Floreal("1799-11-09");
console.log('%s', coup);

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 = require('floreal').Date;
console.log('%s', (new Floreal("1799-10-11")).toFullDateString());

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 = require('floreal').Date;
console.log('%s', (new Floreal("1799-10-11")).toShortDateString());

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 = require('floreal').Date;
var date = new Floreal();
date.setDate(8, 2, 18);
console.log('%s', date.toFullDateString());

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 = require('floreal').Date;
var coup = new Floreal("1799-11-09");
console.log('%s', coup.year());
console.log('%s', coup.yearDecimal());

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 = 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

floreal.Date.firstDayOfYear()

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

floreal.Date.dayOfYear()

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

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 = require('floreal').Date;
console.log('%s', (new Floreal("1799-11-09")).month());

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 = require('floreal').Date;
console.log('%s', (new Floreal("1800-09-20")).isComplementaryDay());

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 = require('floreal').Date;
console.log('"%s"', (new Floreal("1799-11-09")).monthName());
console.log('"%s"', (new Floreal("1800-09-20")).monthName());

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 = 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

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 = 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

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 = 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

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 = require('floreal').Date;
console.log('%s', (new Floreal("1799-11-09")).dayName());

will output:

octidi

floreal.Date.dayTitle()

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

Dependencies (1)

Dev Dependencies (1)

Package Sidebar

Install

npm i floreal

Weekly Downloads

13

Version

1.1.1

License

MIT

Last publish

Collaborators

  • seeschloss