![Oracle Drags Its Feet in the JavaScript Trademark Dispute](https://cdn.sanity.io/images/cgdhsj6q/production/919c3b22c24f93884c548d60cbb338e819ff2435-1024x1024.webp?w=400&fit=max&auto=format)
Security News
Oracle Drags Its Feet in the JavaScript Trademark Dispute
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
date-fns-timezone
Advanced tools
Parsing and formatting date strings using IANA time zones for date-fns.
Provides parsing and formatting date strings and time zone conversions supporting IANA time zones, following the design of functions in date-fns. List of canonical time zone names is provided by timezone-support.
const { listTimeZones } = require('timezone-support')
const { parseFromTimeZone, formatToTimeZone } = require('date-fns-timezone')
// List canonical time zone names: [ 'Africa/Abidjan', ... ]
const timeZones = listTimeZones()
// Set the date to "2018-09-01T16:01:36.386Z"
const date = parseFromTimeZone('2018-09-01 18:01:36.386', { timeZone: 'Europe/Berlin' })
// Set the output to "1.9.2018 18:01:36.386 GMT+02:00 (CEST)"
const date = new Date('2018-09-01Z16:01:36.386Z')
const format = 'D.M.YYYY HH:mm:ss.SSS [GMT]Z (z)'
const output = formatToTimeZone(date, format, { timeZone: 'Europe/Berlin' })
This module can be installed in your project using NPM or Yarn. Make sure, that you use Node.js version 6 or newer.
$ npm i date-fns-timezone --save
$ yarn add date-fns-timezone
Functions are exposed as named exports from the package modules, for example:
const { parseFromTimeZone, formatToTimeZone } = require('date-fns-timezone')
You can read more about the module loading in other environments, like with ES6 or in web browsers. Usage scenarios demonstrate applications of this library in typical real-world scenarios. The API reference lists all functions with a description of their functionality.
In lieu of a formal styleguide, take care to maintain the existing coding style. Add unit tests for any new or changed functionality. Lint and test your code using Grunt.
Copyright (c) 2018 Ferdinand Prantl
Licensed under the MIT license.
FAQs
Parsing and formatting date strings using IANA time zones for date-fns.
The npm package date-fns-timezone receives a total of 42,534 weekly downloads. As such, date-fns-timezone popularity was classified as popular.
We found that date-fns-timezone 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
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
Security News
The Linux Foundation is warning open source developers that compliance with global sanctions is mandatory, highlighting legal risks and restrictions on contributions.
Security News
Maven Central now validates Sigstore signatures, making it easier for developers to verify the provenance of Java packages.