Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/eser/temporal-parse
parses human-readable strings for JavaScript's Temporal API
https://github.com/eser/temporal-parse
acikkaynak api date datetime human-readable javascript javascript-library parse parser temporal
Last synced: 13 days ago
JSON representation
parses human-readable strings for JavaScript's Temporal API
- Host: GitHub
- URL: https://github.com/eser/temporal-parse
- Owner: eser
- License: apache-2.0
- Created: 2022-09-06T11:33:18.000Z (about 2 years ago)
- Default Branch: master
- Last Pushed: 2022-09-24T22:37:55.000Z (about 2 years ago)
- Last Synced: 2024-05-02T05:54:24.950Z (6 months ago)
- Topics: acikkaynak, api, date, datetime, human-readable, javascript, javascript-library, parse, parser, temporal
- Language: TypeScript
- Homepage:
- Size: 65.4 KB
- Stars: 24
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Contributing: CONTRIBUTING.md
- Funding: .github/FUNDING.yml
- License: LICENSE
- Code of conduct: CODE_OF_CONDUCT.md
- Security: SECURITY.md
Awesome Lists containing this project
README
# 🕑 [temporal-parse](https://github.com/eserozvataf/temporal-parse)
[![npm version][npm-image]][npm-url]
[![npm download][npm-download-image]][npm-url]
[![license][license-image]][license-url]## 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
```js
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](LICENSE) file
## Contributing
See [contributors.md](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](https://github.com/eserozvataf/temporal-parse/issues).## To Support
[Visit my GitHub Sponsors profile at github.com/sponsors/eserozvataf](https://github.com/sponsors/eserozvataf)
[npm-image]: https://img.shields.io/npm/v/temporal-parse.svg?style=flat-square
[npm-download-image]: https://img.shields.io/npm/dt/temporal-parse.svg?style=flat-square
[npm-url]: https://www.npmjs.com/package/temporal-parse
[license-image]: https://img.shields.io/npm/l/temporal-parse.svg?style=flat-square
[license-url]: https://github.com/eserozvataf/temporal-parse/blob/master/LICENSE