
Security News
Browserslist-rs Gets Major Refactor, Cutting Binary Size by Over 1MB
Browserslist-rs now uses static data to reduce binary size by over 1MB, improving memory use and performance for Rust-based frontend tools.
timezone-date.ts
Advanced tools
Enhancement of Date class with better timezone support.
Date
methodsJump between timezones:
import { TimezoneDate } from 'timezone-date.ts'
const d = TimezoneDate.fromDate(new Date('2020-04-21T10:00:00.000Z'))
d.timezone = 0
d.getHours() // 10
d.timezone = +8
d.getHours() // 18
d.getTimezoneOffset() // -480 (in mintes, same format as Native Date)
d.setHours(9)
d.timezone++
d.getHours() // 10
d.toLocaleTimeString() // '10:00:00 AM'
Set a specific time (e.g. from UI input)
let date = new TimezoneDate()
date.timezone = +8
date.setFullYear(2020, 11 - 1, 28)
date.setHours(9, 2, 38)
console.log(date.toString()) // Sat Nov 28 2020 09:02:38 GMT+0800 (Hong Kong Standard Time)
npm i timezone-date.ts
import { TimezoneDate } from 'timezone-date.ts'
/* custom timezone */
new TimezoneDate(Date.now(), {timezone: +8})
/* default timezone (in the environment) */
new TimezoneDate() // current time
new TimezoneDate(Date.now())
TimezoneDate.fromTime(Date.now())
TimezoneDate.fromDate(new Date())
TimezoneDate.from(Date.now()) // from Date or timestamp
This is free open sourced software (FOSS), with BSD 2-Clause License
FAQs
Enhancement of Date class with better timezone support
The npm package timezone-date.ts receives a total of 154 weekly downloads. As such, timezone-date.ts popularity was classified as not popular.
We found that timezone-date.ts demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
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.
Security News
Browserslist-rs now uses static data to reduce binary size by over 1MB, improving memory use and performance for Rust-based frontend tools.
Research
Security News
Eight new malicious Firefox extensions impersonate games, steal OAuth tokens, hijack sessions, and exploit browser permissions to spy on users.
Security News
The official Go SDK for the Model Context Protocol is in development, with a stable, production-ready release expected by August 2025.