Coder Social home page Coder Social logo

eser / temporal-parse Goto Github PK

View Code? Open in Web Editor NEW
24.0 1.0 0.0 67 KB

parses human-readable strings for JavaScript's Temporal API

License: Apache License 2.0

TypeScript 100.00%
human-readable javascript javascript-library parser temporal api date datetime parse acikkaynak

temporal-parse's Introduction

๐Ÿ•‘ 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

temporal-parse's People

Contributors

eser avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.