2.4.0 • Published 5 months ago

intre v2.4.0

Weekly downloads
-
License
MIT
Repository
github
Last release
5 months ago

intre

NPM Version NPM Downloads

Intre logo


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 intre

API

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'): 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

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

2.4.0

5 months ago

2.3.0

1 year ago

2.2.6

1 year ago

2.2.1

2 years ago

2.2.0

2 years ago

2.1.1

2 years ago

2.2.3

2 years ago

2.2.2

2 years ago

2.2.5

2 years ago

2.2.4

2 years ago

2.1.0

2 years ago

1.2.1

2 years ago

2.0.2

2 years ago

2.0.1

2 years ago

2.0.0

2 years ago

1.2.0

2 years ago

1.1.1

2 years ago

1.1.5

2 years ago

1.1.4

2 years ago

1.1.3

2 years ago

1.1.2

2 years ago

1.1.0

2 years ago

1.0.7

3 years ago

1.0.6

3 years ago

1.0.5

3 years ago

1.0.4

3 years ago

1.0.3

3 years ago

1.0.2

3 years ago

1.0.1

3 years ago

1.0.0

3 years ago