A little abstraction that isolates aspects of parsing and formatting dates from the underlying Date API which may differ between JVM and Scala.js applications.
The design is very minimal as date handling is not a core aspect of
Laika. For that reason it uses java.util.Date
as the lowest common
denominator. Application code should convert it to the most convenient
type for the platform in use, e.g. with toInstant
on the JVM or
with new js.Date(date.getTime().toDouble)
in Scala.js.
There was a deliberate choice not to depend on any of the available
libraries that port the java.time
API to Scala, as this would
be to heavyweight, in particular for Scala.js.
- Companion:
- object
Type members
Types
The platform-dependent type representing dates.
The platform-dependent type representing dates.
Value members
Abstract methods
Parses the specified string either as a date with time zone, or a local date time, or just a date.
Parses the specified string either as a date with time zone, or a local date time, or just a date.
In case of a date time with time zone, ISO 8601 is supported
(allowing either Z
for UTC or +
/-
followed by a time offset
with or without colon, e.g. +01:30
or +0130
.
In case of the time zone info missing, local date time is assumed.
Examples: 2011-10-10
or 2011-10-10T14:48:00
or 2011-10-10T14:48:00+0100
are all allowed.
This is also designed to be somewhat aligned to Date.parse
in JavaScript.