moment-oadate
v1.0.1
Published
Extends moment to use OADate format
Downloads
16
Readme
moment-oadate
Installation
From NPM:
npm install moment-oadate
Usage
Convert Moment to OA Date:
import moment from "moment";
import "moment-oadate"; // Extends the moment library
const momentDate = moment.utc("21/10/2015", "DD/MM/YYYY");
const oaDate = momentDate.toOADate(); // 42298
Convert OA Date to Moment:
import moment from "moment";
import { fromOADate } from "moment-oadate";
const momentDate = fromOADate(42298.4642);
console.log(momentDate.toDate()); // 2015-10-21T11:08:26.880Z
Note: This library will return all values based on UTC time.
Dependencies
None