Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

localized-dst

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

localized-dst

Determine if a date is in daylight savings time by country/state/city

  • 1.1.2
  • latest
  • npm
  • Socket score

Version published
Weekly downloads
11
increased by37.5%
Maintainers
1
Weekly downloads
 
Created
Source

localized DST

Determine if a date is in daylight savings time by country/state/city

Motivation

I wasn't able to find a correct library to do the simple task is my date during DST (Daylight Savings Time. Every library was old or unconstistant because I learnt the hard way but not every Country/State/City have the same DST...

This is based on the information of https://www.timeanddate.com/time/dst/

Installation

npm install localized-dst

or

yarn add localized-dst

How to use it

import { isDst } from 'localized-dst';

// DST info for Canada, Québec, Montréal
console.log(
  isDst(new Date('2019-08-14 21:00:00'), {
    location: 'CAN.QUEBEC.MONTREAL'
  })
);
// return true

// DST info for France (Paris)
console.log(
  isDst(new Date('2019-11-28 21:00:00'), {
    location: 'FRA'
  })
);
// return false

Implemented DST data

CountryStateCityKeyYears
AustraliaVictoriaMelbourneAUS.VICTORIA.MELBOURNE2000-2030
CanadaQuebecMontrealCAN.QUEBEC.MONTREAL1980-2030
OntarioTorontoCAN.ONTARIO.TORONTO2000-2030
FranceMetropoleParisFRA.METROPOLE.PARIS2000-2030
USAHAWAIUSA.HAWAIall

How to participate

If you think something is missing or corrupted, please submit a PR to this repo!

Some tools

Keywords

FAQs

Package last updated on 03 Oct 2022

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc