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

true-time-format

v1.0.3

Published

True class to parse, format, and manipulate datetimes.

Downloads

9

Readme

True-Time-Format

Smart parsing date and time format for true time.

Support:

  1. The default hundred years value
  2. Daylight Saving Time
  3. Nanoseconds
  4. Leap second

Install

$ yarn add true-time-format

Usage

let time = require('true-time-format');

// for normal datetime string
time.parse('Monday, 02-Jan-06 15:04:05');
time.parse('2006-01-02');
time.parse('02-Jan-2006T15:04:05.999 UTC-0700');

// DST means Daylight Saving Time
// LSC means expecting to consider leap second effects in time calculations
time.parse('02 Jan DST15:04:05.999LSC 2006');

// customize
let parser = new time.Parser('20DYM+0800');

parser.parse('281802');

parser.parse('28 2018 Feb UTC+08:00');
parser.parse('28 2018 Feb GMT+0800');
parser.parse('28-18-02Z+0800');

Layout

The layout argument for un-normal datetime string only.

The layout:

20-0700

Means:

  1. If you match a two-digit year, it represents 20xx years
  2. If the data does not contain UTC offset, use UTC-0700

The default hundred years value

The layout optional number prefix represents the default hundred years value, such as 19 which means 19xx if it matches a two-digit year.

Y

Represents the year.

M

Represents the month, digits or month word.

D

Represents the day.

h

Represents the hour.

m

Represents the minute.

s

Represents the second and dot nanosecond.

UTC offsets

The layout optional suffix +hhmm or -hhmm means the default UTC offset, default is +0000.

License

BSD 2-Clause License

Copyright (c) 2018, YU HengChun [email protected] All rights reserved.