Working with dates in a simple way: using Unix Epoch times. So: numbers.
Install
npm i intre
Intro
intre
is a wrap over day.js providing an API to work with int
-typed dates.
API
Init locale
async intre_locale_init(key)
and async intre_locale_load(key)
Preloaded locales are en
(default) and es
.
You may want to switch between preloaded locales with async intre_locale_init(key)
.
If it is not preloaded, intre
will load it (requires a network fetch) by calling async intre_locale_load(key)
.
Must be called once, when loading your app.
Getters
intre_now()
intre_noon(i)
intre_from_date(d)
intre_from_str(s, fmt = 'DD/MM/YYYY')
intre_from_parts(y, m, d)
Converters
intre_to_date(i)
intre_to_str(i, fmt = 'DD/MM/YYYY')
intre_to_parts(i)
Prettiers
intre_pretty_from_now(i)
intre_pretty_short(i)
Format: "D MMM"
intre_pretty_medium(i)
Format: "DD MMM 'YY"
intre_pretty_long(i)
Format: "DD MMMM YYYY"
intre_pretty_short_with_time(i)
Format: _"D MMM a las HH:MM"
intre_pretty_short_with_from_now(i)
Format: "D MMM ()"
intre_pretty_burocratic(i)
Format: "D de MMMM de YYYY"
Extract date parts
intre_get_seconds(i)
intre_get_minutes(i)
intre_get_hour(i)
intre_get_day(i)
intre_get_week_day(i)
intre_get_month(i)
intre_get_year(i)
intre_get_month_name(i, long=false)
Checks
intre_are_same(i1, i2, what= 'seconds')
what
can be milliseconds
, seconds
(default), minutes
, hours
, day
, month
, year
intre_diff(i1, i2, what= 'seconds', decimals= false)
what
can be milliseconds
, seconds
(default), minutes
, hours
, day
, month
, year