npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

intre

v2.3.0

Published

simple dates with UNIX Epoch Times

Downloads

16

Readme

Intre logo

NPM Version NPM Downloads

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

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.