moment-he
Human Era format for moment.js.
Installation
yarn add moment-he
Examples
const moment = const now = // Base formatsnow // 17 (doesn't apply for short format)now // 12017now // 12017now // 12017now // 12017 // Base formats (with suffix)now // 17now // 12017 HEnow // 12017 HEnow // 12017 HEnow // 12017 HE // Localized formatsnow // 08/06/12017now // 8/6/12017now // August 6, 12017now // Aug 6, 12017now // August 6, 12017 2:36 PMnow // Aug 6, 12017 2:36 PMnow // Sunday, August 6, 12017 2:36 PMnow // Sun, Aug 6, 12017 2:36 PM // Localized formats (with suffix)now // 08/06/12017 HEnow // 8/6/12017 HEnow // August 6, 12017 HEnow // Aug 6, 12017 HEnow // August 6, 12017 HE 2:42 PMnow // Aug 6, 12017 HE 2:42 PMnow // Sunday, August 6, 12017 HE 2:42 PMnow // Sun, Aug 6, 12017 HE 2:42 PM
API
The only new API is the moment().humanEra()
method (also aliased as moment().he()
).
It works exactly like moment().format()
, the only difference being that it returns years in the Holocene Calendar instead of ISO 8601.
moment().humanEra(format[, suffix])
Arguments
format
(string): exact same requirements asmoment().format()
suffix
(boolean): whether to display an extra 'HE' after each year, defaults tofalse
Output
A string, very similar to what moment().format(format)
would return but with HE years!