Class: IsoCounter

chronos.IsoCounter(originYearopt, originMonthopt, originDayopt)

Convert number of days since epoch to or from a date expressed after ISO 8601.

Constructor

new IsoCounter(originYearopt, originMonthopt, originDayopt)

Parameters:
Name Type Attributes Default Description
originYear number <optional>
1970 the epoch year in ISO, a signed integer, default: 1970 for the Unix epoch.
originMonth number <optional>
1 the epoch month in ISO, a number in range 1..12, default: 1.
originDay number <optional>
1 the epoch day of the month in ISO, a number in range 1..31, default: 1. If this day does not exist in this month, date is balanced to next month.
Source:

Methods

toCounter(isoFields) → {number}

Compute day counter, an integer number for the date specified under ISO 8601.
Parameters:
Name Type Description
isoFields Object fields isoYear, isoMonth and isoDay must be specified as integer. isoMonth must lay in range 1..12 if day is out of range of valid days for the month, date is balanced to the number of days out of the range.
Source:
Returns:
the counter, an integer number representing the date with the day counter.
Type
number

toIsoFields(counter) → {Object}

Compute ISO8601 date figures from a number of days since epoch.
Parameters:
Name Type Description
counter number the day counter, a counter representing a date; if not integer, the floor value is taken.
Source:
Returns:
fields isoYear, isoMonth and isoDay specify the date in ISO8601 calendar.
Type
Object