Coder Social home page Coder Social logo

tacticallimit / isodate-lite Goto Github PK

View Code? Open in Web Editor NEW
1.0 2.0 1.0 309 KB

ISO Date Lite is a node/typescript library for coverting object values between ISO8601 date strings and native javascript date objects.

License: Apache License 2.0

JavaScript 5.38% TypeScript 94.62%
dynamodb typescript-library node-library node-module iso8601 dates

isodate-lite's Introduction

isodate-lite

Build dependencies Status Known Vulnerabilities Code Style: Google License: Apache-2.0 Documentation: Provided

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-lite
yarn install isodate-lite

Usage

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

Apache-2.0

isodate-lite's People

Contributors

alchemycs avatar

Stargazers

 avatar

Watchers

 avatar  avatar

Forkers

din-dke

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.