intre v2.4.0
intre

intre. substantivo masculino:
1. Punto preciso no tempo.
Naquel intre chamaron á porta.
Intro
Working with dates in a simple way: using Unix Epoch times. So: numbers.
intre is a wrap over day.js providing an API to work with int-typed dates.
Install
npm i intreAPI
Init locale
async intre_locale_init(key)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'):whatcan bemilliseconds,seconds(default),minutes,hours,day,month,yearintre_diff(i1, i2, what= 'seconds', decimals= false):whatcan bemilliseconds,seconds(default),minutes,hours,day,month,year
Add and subtract
intre_add_days(i, n)intre_add_business_days(i, n, includeSaturdays= false)intre_add_months(i, n)intre_add_years(i, n)intre_sub_days(i, n)intre_sub_months(i, n)intre_sub_years(i, n)
Search close dates
intre_first_of_week(i)intre_last_of_week(i)intre_first_of_month(i)intre_last_of_month(i)intre_first_of_year(i)intre_last_of_year(i)
Ranges
intre_range(iFrom, iTo, includeTo= true)
List locale data
intre_list_first_day_of_week()intre_list_months()intre_list_months_short()intre_list_weekdays()intre_list_weekdays_short()intre_list_weekdays_min()intre_list_long_date_format(f= 'L')
TODO
intre_set_week_day
Set week day within current week. If setting wedenesday for today and today is saturday, returned value will be past wednesday.
Changelog
See changelog here
9 months ago
1 year ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago