Socket
Socket
Sign inDemoInstall

temporal-polyfill

Package Overview
Dependencies
Maintainers
1
Versions
17
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

temporal-polyfill

A spec-compliant Temporal JavaScript polyfill in 16kb


Version published
Weekly downloads
48K
decreased by-26.49%
Maintainers
1
Weekly downloads
 
Created
Source

temporal-polyfill

A spec-compliant Temporal JavaScript polyfill in 16kb*.

Works in modern browsers**, not Internet Explorer.

Codepen

CDN link

Installation

npm install temporal-polyfill

A) Import globally:

import 'temporal-polyfill/global'

console.log(Temporal.Now.zonedDateTimeISO().toString())

B) Import as an ES module without side effects:

import { Temporal } from 'temporal-polyfill'

console.log(Temporal.Now.zonedDateTimeISO().toString())

C) The above techniques try using the built-in Temporal object and fall back to the polyfill. To guarantee using the polyfill, do this:

import { Temporal } from 'temporal-polyfill/impl'

console.log(Temporal.Now.zonedDateTimeISO().toString())

* = the size will shrink as the codebase is cleaned up

** = targets browsers that support BigInt, however, more browser-compatibility work is needed

FAQs

Package last updated on 06 May 2022

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