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.
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
Apache 2.0, for further details, please see LICENSE file
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.
Visit my GitHub Sponsors profile at github.com/sponsors/eserozvataf