Home Reference Source Repository

Immutable data and time library for javascript

npm version Build Status Coverage Status

Introduction

JS-Joda-Time is a project that wants to bring joda time library to the javascript world. The Project is in a very early state. Be aware that the most of the things written here are not ready yet

JS-Joda-Time, a port of the Joda-Time immutable data and time library to javascript. It provides a simple and clean API based on the ISO8601 calendar. Joda-Time is the de facto standard date and time library for Java. From Java SE 8 it is part of the jdk at java.time (JSR-310).

Why yet another javascript date and time library

Getting started

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.

Node

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

Browser

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>

Documentation

License