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

@easepick/datetime

v1.2.1

Published

DateTime object for easepick.

Downloads

66,256

Readme

@easepick/datetime

npm version

This package does not need to be installed if you are using @easepick/bundle.

DateTime library for easepick.

Documentation

https://easepick.com/packages/datetime

DateTime() constructor

Creates a JavaScript DateTime instance that represents a single moment in time.
Using: new DateTime(date, format, lang)

| argument | type | default value | description | --- | :---: | :---: | --- | date | Date string number | null | Date object or date string or number (unix timestamp). | format | string | 'YYYY-MM-DD' | Required when you provide date argument as string. Must match a string value for proper parsing. | lang | string | 'en-US' | Affects month names (MMM, MMMM tokens).

You can omit all arguments and call new DateTime(). This will create a DateTime object represents the current date.

Methods

| name | arguments | description | --- | --- | --- | getWeek | - | Returns a week number of date | clone | - | Returns a copy of date | toJSDate | - | Returns Date object. | inArray | (array, inclusivity) | Find DateTime object in passed DateTime array. | isBetween | (date1, date2, inclusivity) | Check if a DateTime is between two other DateTime. | isBefore | (date, unit) | Check if a DateTime is before another DateTime. unit are day, month, year. | isSameOrBefore | (date, unit) | Check if a DateTime is before or the same as another DateTime. unit are day, month. | isAfter | (date, unit) | Check if a DateTime is after another DateTime.. unit are day, month, year. | isSameOrAfter | (date, unit) | Check if a DateTime is after or the same as another DateTime. unit are day, month. | isSame | (date, unit) | Check if a DateTime is the same as another DateTime. unit are day, month. | add | (duration, unit) | Mutates the original DateTime by adding unit. unit are day, month. | subtract | (duration, unit) | Mutates the original DateTime by subtracting unit. unit are day, month. | diff | (date, unit) | Returns diff between two DateTime. unit are day, month. | format | (format, lang) | Format output. See tokens format for format argument. lang affects month names (MMM, MMMM tokens).

Tokens format

Tokens are case-sensitive.

| | Token | Output | --- | :---: | --- | Day of Month | D | 1 2 … 30 31 | | DD | 01 02 … 30 31 | Month | M | 1 2 … 11 12 | | MM | 01 02 … 11 12 | | MMM | Jan Feb … Nov Dec | | MMMM | January February … November December | Year | YY | 70 71 … 29 30 | | YYYY | 1970 1971 … 2029 2030 | Hours (24 hour time) | H | 0 1 … 22 23 | | HH | 01 02 … 22 23 | Minutes | m | 1 2 … 58 59 | | mm | 01 02 … 58 59 | Seconds | s | 1 2 … 58 59 | | ss | 01 02 … 58 59