Socket
Socket
Sign inDemoInstall

timestamp-zoned

Package Overview
Dependencies
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

timestamp-zoned

A small module that generates an ISO 8601 timestamp including a zone


Version published
Weekly downloads
1
Maintainers
1
Weekly downloads
 
Created
Source

Quick ISO 8601 timestamps that definitely include the timezone

The standard JS APIs for dates don't necessarily include the current timezone, because it's all open. This uses the current timezone information to make sure you get the zone information you need.

The result is an ISO 8601 time, which always parses to be the same as the current time.

You can also add a {zone: true} option to get an added, browser-derived location zone name, if one is available. This, obviously, is no longer ISO 8601 so simply trim after the first space if you need to.

Usage

var times = require('timestamp-zoned');

times.getTimestamp();
//=> '2018-08-28T15:04:25.247-04:00'
times.getTimestamp({zone: true});
//=> '2018-08-28T15:04:50.009-04:00 (America/Toronto)'

License

Copyright © 2018, Stuart Watt. Released under the MIT License.

FAQs

Package last updated on 28 Aug 2018

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