JSPM

temporal-parse

0.0.8
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 19
  • Score
    100M100P100Q36050F
  • License Apache-2.0

Package Exports

  • temporal-parse
  • temporal-parse/package.json
  • temporal-parse/polyfill

Readme

🕑 temporal-parse

npm version npm download license

What is the temporal-parse?

Temporal is the next generation of JavaScript's standard Date API. It's currently proposed to TC39 (see: https://github.com/tc39/proposal-temporal) and in Stage 3.

However Temporal brings many features, there'll be no "human-readable string format parsing". (see: https://tc39.es/proposal-temporal/docs/strings.html)

This project aims to parse human-readable strings for Temporal, and generate proper inputs for Temporal's Temporal.xxxx.from() functions.

Sample Usage

import "npm:temporal-parse/polyfill";
import { parseDate, toDate, toTemporal } from "npm:temporal-parse";

const parsedDate = parseDate("07/12/1995", "en-GB"); // { year: 1995, month: 12, day: 7 }

// new temporal Date API
const temporal = toTemporal(parsedDate);
console.log(temporal.toString()); // => 1995-12-07

// old Date API
const date = toDate(parsedDate);
console.log(date.toString()); // => 1995-12-07T00:00:00

License

Apache 2.0, for further details, please see LICENSE file

Contributing

See contributors.md

It is publicly open for any contribution. Bugfixes, new features and extra modules are welcome.

  • To contribute to code: Fork the repo, push your changes to your fork, and submit a pull request.
  • To report a bug: If something does not work, please report it using GitHub Issues.

To Support

Visit my GitHub Sponsors profile at github.com/sponsors/eserozvataf