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 🙏

© 2026 – Pkg Stats / Ryan Hefner

date.format

v1.1.2

Published

JS Date format => date.format('Today {Y}/{M}/{D} at {h}:{m}:{s}h and {ms}ms');

Readme

Date.format

license Build Status npm version Github release npm downloads

Languages:[EN,ES]

Add to JS Date.prototype .format() method, allow format the object date in a readable form.
Call to method with the pattern you want and will return it formated.

Date.format is based on String.format > "Hello {name}!".format({name:"Homer"});

npm

Date.prototype.format( pattern [, UTC]);
  • pattern (string): Pattern to fomat the date. Values of the date are enclosed in braces: {M}, {D}, etc. See below reference.
  • UTC (boolean): true if UTC. False to GMT.
  • return a formated String.
require('date.format');

var date = new Date();
console.log(date.format("Local: Day {Y}/{M}/{D} at {h}:{m}:{s} and {ms}ms"));
console.log(date.format("Local: Day {YY}/{MM}/{DD} at {hh}:{mm}:{ss} and {mss}ms"));
console.log(date.format("UTC: Day {Y}/{M}/{D} at {h}:{m}:{s} and {ms}ms",true));
console.log(date.format("UTC: Day {YY}/{MM}/{DD} at {hh}:{mm}:{ss} and {mss}ms",true));

/*

>> Local: Day 2015/1/5 at 20:44:58 and 803ms
>> Local: Day 15/01/05 at 20:44:58 and 0803ms
>> UTC: Day 2015/1/5 at 19:44:58 and 803ms
>> UTC: Day 15/01/15 at 19:44:58 and 0803ms

*/
  • Y or YYYY: Year with four digits. YY Year 2 digits, 00-99
  • M: Month without leading zeros 1-12. MM Month 2 digits.
  • D: Day without leading zeros 1-31. DD Day 2 digits.
  • h: hour without leading zeros 0-23. hh hour 2 digits.
  • m: minutes without leading zeros 0-59. mm minutes 2 digits.
  • s: seconds without leading zeros 0-59. ss seconds 2 digits.
  • ms: milliseconds without leading zeros 0-999. mss milliseconds 4 digits.

NEW:

  • tz: Timezone difference between UTC and Local Time in minutes
  • tzh: Timezone difference between UTC and Local Time in hours

Licence

MIT


Date.format (es)

Añade a Date.prototype de JS el método .format(), permitiendo formatear el objeto date de una forma legible. Especificamos al método el formato en el que devolverá el objeto date.

Date.format utiliza String.format > "Hello {name}!".format({name:"Homer"});

npm

Date.prototype.format( pattern [, UTC]);
  • pattern (string): patrón con el formato de sustitución de String.format
  • UTC (boolean): true si el date es UTC. False para GMT.
require('date.format');

var date = new Date();
console.log(date.format("Local: Day {Y}/{M}/{D} at {h}:{m}:{s} and {ms}ms"));
console.log(date.format("Local: Day {YY}/{MM}/{DD} at {hh}:{mm}:{ss} and {mss}ms"));
console.log(date.format("UTC: Day {Y}/{M}/{D} at {h}:{m}:{s} and {ms}ms",true));
console.log(date.format("UTC: Day {YY}/{MM}/{DD} at {hh}:{mm}:{ss} and {mss}ms",true));

/*

>> Local: Day 2015/1/5 at 20:44:58 and 803ms
>> Local: Day 15/01/05 at 20:44:58 and 0803ms
>> UTC: Day 2015/1/5 at 19:44:58 and 803ms
>> UTC: Day 15/01/15 at 19:44:58 and 0803ms

*/
  • Y y YYYY: Año completo. YY Año 2 dígitos, 00-99
  • M: Mes sin ceros iniciales 1-12. MM Mes en 2 dígitos.
  • D: Día sin ceros iniciales 1-31. DD Día en 2 dígitos.
  • h: hora sin ceros iniciales 0-23. hh hora en 2 dígitos.
  • m: minutos sin ceros iniciales 0-59. mm minutos en 2 dígitos.
  • s: segundos sin ceros iniciales 0-59. ss segundos en 2 dígitos.
  • ms: milisegundos sin ceros iniciales 0-999. mss milisegundos 4 dígitos.

NEW:

  • tz: Diferencia de la zona horaria con respecto a UTC en minutos
  • tzh: Diferencia de la zona horaria con respecto a UTC en horas

Licencia

MIT