Questions tagged [js-joda]

js-joda is an immutable date and time library for javascript.

About

Popular javascript date libraries like moment or date-utils are wrappers around the native javascript Date object, providing syntactic sugar. The native Date object always consist of a date, time and a timezone part. In opposite to that, js-joda is a standalone date and time implementation.

Getting started

Node

Install joda using npm

npm install js-joda

Then require it to any module

var LocalDate = require('js-joda').LocalDate;

var d = LocalDate.parse('2012-12-24').atStartOfDay().plusMonths(2); // 2013-02-24T00:00:00

Browser

To use js-joda from a browser, download either dist/js-joda.min.js or dist/js-joda.js (with sourcemaps for development)

Then add it as a script tag to your page

<script src="js-joda.min.js"></script>
<script>
    var LocalDate = JSJoda.LocalDate;
    var d = LocalDate.parse('2012-12-24').atStartOfDay().plusMonths(2); // 2013-02-24T00:00:00
</script>

Documentation

  • Cheat Sheet Quick start guide
  • API ESDoc generated API documentation
  • js-joda Homepage Project homepage

Links

19 questions
0
votes
1 answer

Formatting a Joda LocalDateTime variable with Js Joda Library in Angular 10

Good Morning, I have an Angular 10 application in which I try to print some LocalDateTime variables in an HTML page. The LocalDateTime variable are correctly fetched from the BackEnd and are of type Joda.LocalDateTime, the serialization happens…
DiegLuthor
  • 195
  • 1
  • 14
0
votes
0 answers

JS-Joda / LocalTime support for days with more than 24 hours

GTFS feeds do not operate on the basis of a 24 hour day, for instance a trip that departs at 23:00 may arrive at 24:30 (more details). LocalTime only supports 24 hour days - is there another construct that does support days with more than 24 hours?…
Linus Norton
  • 557
  • 1
  • 4
  • 15
0
votes
1 answer

ReferenceError: LocalDateTime not defined

I am trying to use the js joda in my HTML page and following is the code extract:
Sudhi
  • 3
  • 3
0
votes
1 answer

TextStyle in js-joda is undefined

I imported the classes this way: const { LocalDate, TextStyle } = require('js-joda'); console.log(TextStyle); Output: undefined I would like to use it as follows: const dateTime =…
vovahost
  • 34,185
  • 17
  • 113
  • 116
1
2