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

date-format-ldml

v2.2.1

Published

A date formatting library based on Steven Levithan's Date Format 1.2.3, that attempts to stay closer to Unicode locale data markup language standard

Downloads

2

Readme

Overview

This is a date formatting library based on Steven Levithan's Date Format 1.2.3, that attempts to stay closer to Unicode locale data markup language standard.

Installation and usage

Use npm to get the library and reference it on your HTML page

npm install date-format-ldml

The library is AMD and Commonjs aware, but it can be used without them:

var datetime = new Date(2018, 03 - 1, 1, 14, 20, 31, 123);
console.log(dateFormat(datetime, "yyyy MM dd HH:mm:ss - L"));

2018 03 01 14:20:31 - 12

Masks

Initial masks were changed to stay closer to the unicode standard. Here is the table of all supported characters:

| Mask | Description | |----------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| | d | Day of the month as digits; no leading zero for single-digit days | | dd | Day of the month as digits; leading zero for single-digit days | | D | Day of the year as digits; no leading zero for single-digit days | | DD | Day of the year as digits; leading zero for single-digit days | | DDD | Day of the year as digits; two leading zeroes for two-digit days | | E | Day of the week as a three-letter abbreviation | | EE | Day of the week as a three-letter abbreviation | | EEE | Day of the week as a three-letter abbreviation | | EEEE | Day of the week as its full name | | e | Day of the week as digits; no leading zero for single-digit days. Monday is 1, Sunday is 7 | | ee | Day of the week as digits; leading zero for single-digit days. Monday is 01, Sunday is 07 | | eee | Day of the week as a three-letter abbreviation | | eeee | Day of the week as its full name | | M | Month as digits; no leading zero for single-digit months | | MM | Month as digits; leading zero for single-digit months | | MMM | Month as a three-letter abbreviation | | MMMM | Month as its full name | | y | Year represented by four digits | | yy | Year as last two digits; leading zero for years less than 10 | | yyy | Year as last three digits; two leading zeroes for years less than 10 | | yyyy | Year represented by four digits | | QQQ | Quarter. Q1, Q2, Q3, Q4 | | w | Week of year as digits according to ISO 8601; no leading zero for single-digit weeks | | ww | Week of year as digits according to ISO 8601; leading zero for single-digit weeks | | h | Hours; no leading zero for single-digit hours (12-hour clock) | | hh | Hours; leading zero for single-digit hours (12-hour clock) | | H | Hours; no leading zero for single-digit hours (24-hour clock) | | HH | Hours; leading zero for single-digit hours (24-hour clock) | | m | Minutes; no leading zero for single-digit minutes | | mm | Minutes; leading zero for single-digit minutes | | s | Seconds; no leading zero for single-digit seconds | | ss | Seconds; leading zero for single-digit seconds | | l or L | Milliseconds. l gives 3 digits. L gives 2 digits | | a | AM or PM | | Z | GMT/UTC timezone offset, e.g. -0500 or +0230 | | ZZZZ | The long localized GMT format, e.g. GMT-5:00 | | S | The date's ordinal suffix (st, nd, rd, or th). Works well with d | | '…'or"…" | Literal character sequence. Surrounding quotes are removed | | UTC: | Must be the first four characters of the mask. Converts the date from local time to UTC/GMT/Zulu time before applying the mask. The "UTC:" prefix is removed |