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

locale-timezone-date

v5.0.1

Published

JavaScript local time zone Date module

Downloads

2

Readme

localeTimezoneDate

JavaScript locale time zone Date module

const LocaleTimezoneDate = require("locale-timezone-date");
const LocaleTimezoneDate = require("locale-timezone-date");
//
//
let localeDate = new LocaleTimezoneDate();
console.log(localeDate instanceof Date);
// true
//
//
/////////////////////////////////////////////////
// toLocaleISOString
//
console.log(localeDate.toLocaleISOString());
// "2021-04-09T09:15:43.062+0200"
console.log(new Date(localeDate.toLocaleISOString()).toISOString() === localeDate.toISOString());
// true
//
//
/////////////////////////////////////////////////
// toFalsyLocaleISOString
//
console.log(localeDate.toFalsyLocaleISOString());
// "2021-04-09T09:15:43.062Z"
console.log(new Date(localeDate.toFalsyLocaleISOString()).toISOString() === localeDate.toISOString());
// false
//
//
/////////////////////////////////////////////////
// yyyymmdd - TIME UTC0 - HOUR 0
//
const H00_Z = "2020-08-06T00:00:00.000Z";
localeDate = new LocaleTimezoneDate(H00_Z);
console.log(localeDate.yyyymmdd());
// "2020-08-06"
console.log(localeDate.getUTCOffset());
// { hhmm: '+0200', hour: 2 }
//
// yyyymmdd - TIME UTC0 - HOUR 22
//
const H22_Z = "2020-08-06T22:00:00.000Z";
localeDate = new LocaleTimezoneDate(H22_Z);
console.log(localeDate.yyyymmdd());
// "2020-08-07"
console.log(localeDate.getUTCOffset());
// { hhmm: '+0200', hour: 2 }
//
//
/////////////////////////////////////////////////
// yyyymmdd - LOCALE TIME - HOUR 0
//
const H00_UTC2 = "2020-08-06T00:00:00.000+0200";
localeDate = new LocaleTimezoneDate(H00_UTC2);
console.log(localeDate.yyyymmdd());
// "2020-08-06"
console.log(localeDate.getUTCOffset());
// { hhmm: '+0200', hour: 2 }
//
// yyyymmdd - LOCALE TIME - HOUR 22
//
const H22_UTC2 = "2020-08-06T22:00:00.000+0200";
localeDate = new LocaleTimezoneDate(H22_UTC2);
console.log(localeDate.yyyymmdd());
// "2020-08-06"
console.log(localeDate.getUTCOffset());
// { hhmm: '+0200', hour: 2 }
//
//
/////////////////////////////////////////////////
// msStartOfYear - START OF THE YEAR - LOCALE
//
localeDate = new LocaleTimezoneDate();
const startOfYearLocale = localeDate.startOfYear({ ms: false });
console.log(startOfYearLocale.toISOString());
// "2020-12-31T23:00:00.000Z"
console.log(startOfYearLocale.toLocaleISOString());
// "2021-01-01T00:00:00.000+0100"
//
// msStartOfYear - START OF THE YEAR - NOT LOCALE
//
const startOfYear = localeDate.startOfYear({ ms: false, locale: false });
console.log(startOfYear.toISOString());
// "2021-01-01T00:00:00.000Z"
console.log(startOfYear.toLocaleISOString());
// "2021-01-01T01:00:00.000+0100"
//
//
/////////////////////////////////////////////////
// msStartOfMonth - START OF THE MONTH - LOCALE
//
const startOfMonthLocale = localeDate.startOfMonth({ ms: false });
console.log(startOfMonthLocale.toISOString());
// "2021-03-31T22:00:00.000Z"
console.log(startOfMonthLocale.toLocaleISOString());
// "2021-04-01T00:00:00.000+0200"
//
// msStartOfMonth - START OF THE MONTH - NOT LOCALE
//
const startOfMonth = localeDate.startOfMonth({ ms: false, locale: false });
console.log(startOfMonth.toISOString());
// "2021-04-01T00:00:00.000Z"
console.log(startOfMonth.toLocaleISOString());
// "2021-04-01T02:00:00.000+0200"
//
//
/////////////////////////////////////////////////
// msStartOfDate - START OF THE DAY - LOCALE
//
const startOfDateLocale = localeDate.startOfDate({ ms: false });
console.log(startOfDateLocale.toISOString());
// "2021-04-08T22:00:00.000Z"
console.log(startOfDateLocale.toLocaleISOString());
// "2021-04-09T00:00:00.000+0200"
//
// msStartOfDate - START OF THE DAY - NOT LOCALE
//
const startOfDate = localeDate.startOfDate({ ms: false, locale: false });
console.log(startOfDate.toISOString());
// "2021-04-09T00:00:00.000Z"
console.log(startOfDate.toLocaleISOString());
// "2021-04-09T02:00:00.000+0200"