nicompte / edtfy Goto Github PK
View Code? Open in Web Editor NEWJavascript date parser
Home Page: https://edtfy.barbotte.net
License: MIT License
Javascript date parser
Home Page: https://edtfy.barbotte.net
License: MIT License
Thank you for this amazing work, especially the i18n aspect of it.
As EDTF is typically used for storage, I think most users will also need the API to output the human-readable display of such EDTF data on the client/browser side. Do you plan that feature?
Thanks.
This link http://www.loc.gov/standards/datetime/pre-submission.html is a "Page not found" now
In doing some more testing (and confirming on your website), I found some unexpected behavior with using dashes vs. slashes for separating Level 0 dates of the form YYYY-MM:
For instance:
2000 => 2000 (great!)
2001-12 => 2001/12 (unexpected since / are not allowed)
2001/12 => error/could not be parsed (would have expected 2001-12)
Super work on this parser -- it's extremely handy!
I'm getting a syntax error when passing certain valid dates that meet edtf standards and was wondering if this was expected behavior (and if you have a suggested way for me to handle this while still catching "real"/un-parseable errors).
For instance:
If a user inputs "1892", edtfy returns the string with no error (=great!).
If a user inputs "around 1892", edtfy returns 1892~ (=awesome!).
If a user inputs "1892~", edtfy throws:
peg$SyntaxError {message: "Expected " ", " / ", " A ", " B2 ", " C", " O ", "…", "u", "x", [0-9]
or end of input but "~" found.", expected: Array[13], found: "~",
location: Object, name: "SyntaxError"}
which I didn't expect (I was expecting it to just pass the string back to me).
Similarly, if a user inputs "open", it throws a similar peg error:
peg$SyntaxError {message: "Expected " ", " / ", " A ", " B2 ", " O ", "*", "-…, [0-9], [ivxlcdm]
or end of input but "O" found.", expected: Array[22], found: "O",
location: Object, name: "SyntaxError"}
I checked with "1892?" and edtfy passes the string back to me, which was what I was expecting with "1892~".
Am I missing something? Thanks!
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.