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-tz

v0.1.2

Published

Wrapper above js native Date object for using with time zones that differs from current

Downloads

891

Readme

constructor

Wrapper above js native Date object for using with time zones that differs from current

Parameters

  • zone string zone (optional, default '+0000')
  • args any any data to initialize native date object

Examples

import DateTz from 'DateTz';
const date = new DateTz('+0300', '2000-01-01T00:00:00.000Z');
i.toISOString(); // '2000-01-01T00:00:00.000Z'

zone

Parameters

Examples

import DateTz from 'DateTz';
const i = new DateTz('+0000', '2000-01-01T00:00:00.000Z');
i.zone // '+0000';
i.getTzHours(); // 0
i.getUTCHours(); // 0
i.zone = '+0300';
i.zone; // '+0300'
i.getTzHours(); // 3
i.getUTCHours(); // 0

getTzDate

returns date in zone

Examples

import DateTz from 'DateTz';
const i = new DateTz('+06', '2000-01-10T00:00:00.000+06:00');
i.setTzDate(12);
i.getTzDate(); // 12
i.getUTCDate(); // 13

Returns number

getTzDay

returns day of week in zone

Examples

import DateTz from 'DateTz';
const i = new DateTz('06', '2000-01-10T00:00:00.000+06:00');
i.setTzDate(12);
i.getTzDay(); // 3
i.getUTCDay(); // 2

Returns number

getTzFullYear

returns year in zone

Examples

import DateTz from 'DateTz';
const i = new DateTz('+06', '2000-01-01T00:00:00.000+06:00');
i.setTzFullYear(2002);
i.getTzFullYear(); // 2002
i.getUTCFullYear(); // 2001

Returns number

getTzHours

returns hours in zone

Examples

import DateTz from 'DateTz';
const i = new DateTz('-06', '2000-01-01T06:00:00.000Z');
i.getTzHours(); // 0
i.setTzHours(2);
i.getTzHours(); // 2
i.getUTCHours(); // 8;

Returns number

getTzMilliseconds

returns milliseconds in zone

Examples

import DateTz from 'DateTz';
const i = new DateTz('-06', '2000-01-01T00:00:00.000Z');
i.setTzMilliseconds(15);
i.getTzMilliseconds(); // 15
i.getUTCMilliseconds(); // 15

Returns number

getTzMinutes

returns minutes in zone

Examples

import DateTz from 'DateTz';
const i = new DateTz('-0603', '2000-01-01T06:00:00.000Z');
i.setTzMinutes(15);
i.getTzMinutes(); // 15
i.getUTCMinutes(); // 18

Returns number

getTzMonth

returns month in zone

Examples

import DateTz from 'DateTz';
const i = new DateTz('-06', '2000-01-30T20:00:00.000-06:00');
i.setTzMonth(5);
i.getTzMonth(); // 5
i.getUTCMonth(); // 6

Returns number

getTzSeconds

returns seconds in zone

Examples

import DateTz from 'DateTz';
const i = new DateTz('-06', '2000-01-01T00:00:00.000Z');
i.setTzMilliseconds(15);
i.getTzMilliseconds(); // 15
i.getUTCMilliseconds() // 15

Returns number

getTzTimezoneOffset

returns offset between zone and UTC

Examples

import DateTz from 'DateTz';
i = new DateTz('-0507', '2000-01-30T20:00:00.000-06:00');
i.getTzTimezoneOffset(); // 307

Returns number

setTzDate

set date in zone

setTzFullYear

set year in zone

setTzHours

set hours in zone

setTzMilliseconds

set milliseconds in zone

setTzMinutes

set minutes in zone

setTzMonth

set month in zone

setTzSeconds

set seconds in zone

Installation

npm install --save DateTz