In opposite to that, JS-Joda-Time is a standalone date and time implementation. It brings concepts like a LocalDate that allows to handle dates like birthdays or holidays in a clean and error-safe way, especially if this dates are persisted to an external server.
JS-Joda-Time is immutable. Immutability aligns well with pure functions and with the architecture of frameworks like React and Flux.
JS-Joda-Time is a port of the sophisticated, robust and domain-driven API of Joda-Time (to be more precise of the jdk8 java.time package).
The library is in a very early state, far away from productive. But you are very welcome to play around with JS-Joda-Time and to give your feedback. Please check the tests and the API Documentation for the current state of development.
Install joda using npm
npm install js-joda-time
Then require it to any module
var LocalDate = require('js-joda-time').LocalDate; var d = LocalDate.parse('2012-12-24').atStartOfDay().plusMonths(2); // 2013-02-24T00:00:00
To use JS-Joda-Time from a browser, download either dist/jsJodaTime.min.js or dist/jsJodaTime.js (with sourcemaps for development)
Then add it as a script tag to your page
<script src="jsJodaTime.min.js"></script> <script> var LocalDate = jsJodaTime.LocalDate; var d = LocalDate.parse('2012-12-24').atStartOfDay().plusMonths(2); // 2013-02-24T00:00:00 </script>
- Cheat Sheet Quick start guide
- API ESDoc generated API documentation hosted by the ESDoc Hosting Service
- JS-Joda-Time Homepage Project homepage
The License model is still under consideration, but it will be an open source license.
Joda-Time is under Apache 2.0 licence.
OpenJdk is under GNU GPL+linking exception.