1.0.0 • Published 5 years ago
isodate-lite v1.0.0
isodate-lite
ISO Date Lite is a node/typescript library for coverting object values between
ISO8601 date strings and native javascript date objects.
It was originally written as part of another project to cope with the @aws-sdk/util-dynamodb DynamoDB limitations while storing dates.
Documentation
The API documentation can be found at https://tacticallimit.github.io/isodate-lite/
Installation
Use the npm or yarn package manager to install isodate-lite.
npm install isodate-liteyarn install isodate-liteUsage
import {convertDatesToISOStrings, convertISOStringsToDates} from 'isodate-lite';
const exampleDateObject = {
name: 'Eris',
age: 23,
weapons: ['kallisti'],
runDate: new Date(),
};
const exampleISOStringObject = {
name: 'Bob',
age: 42,
weapons: ['pipe'],
runDate: '2021-02-14T09:02:10.232Z',
};
function main() {
const toStringExample = convertDatesToISOStrings(exampleDateObject);
console.log('To string example:', toStringExample);
const toDateExample = convertISOStringsToDates(exampleISOStringObject);
console.log('To date example:', toDateExample);
}
main();Contributing
Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.
Please make sure to update tests as appropriate.
License
1.0.0
5 years ago