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 🙏

© 2025 – Pkg Stats / Ryan Hefner

nor-date

v0.1.22

Published

Date and time helpers for Node.js and browsers

Readme

nor-date

Date helpers for Node.js

Getting Started

You can install nor-date from the NPM:

`npm install nor-date`

Use it inside Node.js like: var nor_date = require('nor-date');

This library is also supported on browser side but all features are not tested yet.

License

It's licenced under the MIT license.

nor_date.format ( {string}format, {Date}timestamp, {object}opts )

This function formats timestamp -- which is an instance of Date -- into format specified by the string format option. If time is ommited the current time will be used.

All arguments are optional arguments. The order of these arguments is not important. However please note that the type is very important.

The format is a string in the same format as strftime() system call is using, except that the library re-implements, so there might be small differences and unsupported features. Please create issues if you find missing features or wrong behaviour.

The opts -- which is an object -- can be used to change the locale with the property named lang.

Example 1

To get current date as YYYY-MM-DD you can call it nor_date.format('%Y-%m-%d').

Example 2

To get current month name in Finnish locale you can call it nor_date.format('%B', {lang:'fi'}) or nor_date.format({lang:'fi'}, '%B').

Example 3

To get month of t, which is instance of Date, in Finnish locale you can call it like:

var t = new Date(2013, 8, 15);
console.log( nor_date.format({lang:'fi'}, '%B', t) );

Binding support

Because format() supports each argument in any order, it makes binding functions very easy.

var t = new Date(2013, 8, 15);

var fi_format = nor_date.format.bind(undefined, {lang:'fi'});
var fi_date_format = nor_date.format.bind(undefined, {lang:'fi'}, '%a %d %B %Y');

console.log( fi_format('%a %d %B %Y', t) );
console.log( fi_date_format(t) );

Locale support

Currently only English as en and Finnish as fi is supported.

However you may implement your own locale like this:

// Setup custom locale fi and make it a copy of $def
nor_date.setupLocale("fi", "$def", {
    "title": "Finnish locale",
    "days_short": [
        'su', 'ma', 'ti', 'ke', 'to', 'pe', 'la', 'su'
    ],
    "days_long":  [
        'sunnuntai', 'maanantai', 'tiistai', 'keskiviikko', 'torstai', 
		'perjantai', 'lauantai', 'sunnuntai'
    ],
    "months_short": [
        'tammi', 'helmi', 'maalis', 'huhti', 'touko', 'kesä', 'heinä', 'elo', 
		'syys', 'loka', 'marras', 'joulu'
    ],
    "months_long": [
        'tammikuu', 'helmikuu', 'maaliskuu', 'huhtikuu', 'toukokuu', 'kesäkuu', 
		'heinäkuu', 'elokuu', 'syyskuu', 'lokakuu', 'marraskuu', 'joulukuu'
    ],
    "format_date": "%d.%m.%Y",
    "format_time": "%H:%M:%S",
    "format_datetime": "%d.%m.%Y %H:%M:%S"
});

Commercial Support

You can buy commercial support from Sendanor.