Socket
Socket
Sign inDemoInstall

@keen.io/time-utils

Package Overview
Dependencies
1
Maintainers
3
Versions
9
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    @keen.io/time-utils

Keen time utilities


Version published
Weekly downloads
23
increased by9.52%
Maintainers
3
Install size
664 kB
Created
Weekly downloads
 

Readme

Source

@keen.io/time-utils

Known Vulnerabilities

Set of utilities and helper functions responsible for dates and time conversion.

API

getOffsetFromDate

Extracts UTC offset from provided date.

getOffsetFromDate('2021-03-14T16:00:00+03:00');  // 180

formatDate

Formats date based on provided pattern and timezone.

formatDate('2021-03-30T12:00:00+02:00', 'Europe/Warsaw', 'YYYY-MM-DD HH:mm'); // 2021-03-30 12:00

convertDate

Converts date based on provided offset in minutes or named timezone. Respects daylight saving time offsets.

convertDate('2021-03-14T16:00:00', 180);  // 2021-03-14T19:00:00
convertDate('2021-03-14T16:00:00', -60);  // 2021-03-14T15:00:00
convertDate('2021-03-14T16:00:00', 'Europe/Warsaw');  // 2021-03-14T17:00:00

setTimezoneOffset

Replaces timezone offset without modifying date.

setTimezoneOffset('2021-03-14T16:00:00-12:00', 'Europe/Warsaw');  // 2021-03-14T16:00:00+02:00

getDefaultAbsoluteTime

Creates default date range aligned with Keen API absolute Timeframe interface.

// new Date() => 2021-03-31T00:00:00

getDefaultAbsoluteTime();  
/* Object {
  "start": "2021-03-30T00:00:00",
  "end": "2021-03-31T00:00:00",
} */

FAQs

Last updated on 23 Nov 2021

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.

Install

Related posts

SocketSocket SOC 2 Logo

Product

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc