Product
Introducing SSO
Streamline your login process and enhance security by enabling Single Sign-On (SSO) on the Socket platform, now available for all customers on the Enterprise plan, supporting 20+ identity providers.
@keen.io/time-utils
Advanced tools
Readme
@keen.io/time-utils
Set of utilities and helper functions responsible for dates and time conversion.
Extracts UTC offset from provided date.
getOffsetFromDate('2021-03-14T16:00:00+03:00'); // 180
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
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
Replaces timezone offset without modifying date.
setTimezoneOffset('2021-03-14T16:00:00-12:00', 'Europe/Warsaw'); // 2021-03-14T16:00:00+02:00
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
Keen time utilities
The npm package @keen.io/time-utils receives a total of 22 weekly downloads. As such, @keen.io/time-utils popularity was classified as not popular.
We found that @keen.io/time-utils demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 3 open source maintainers 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.
Product
Streamline your login process and enhance security by enabling Single Sign-On (SSO) on the Socket platform, now available for all customers on the Enterprise plan, supporting 20+ identity providers.
Security News
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
Security News
As cyber threats become more autonomous, AI-powered defenses are crucial for businesses to stay ahead of attackers who can exploit software vulnerabilities at scale.