iso-date-to-localdate

1.0.4 • Public • Published

This will help to play around date time

I see many developer stuck to save datetime and retrive that datetime as per client current timezone.

So this npm module will help you to convert datetime to iso string datetime format.

It will also helpful to convert iso string datetime to local time zone date time.

Intersting thing about this module is it support moment js feature too.

How to install

'npm i iso-date-to-localdate'

How to use

------------- Support All moment js feature ------------------------

    var d = require('iso-date-to-localdate');

    var momentdate = d.moment(date);

    For more infomation follow https://momentjs.com/docs/ official docs

-------------- Convert datetime to isostring datetime ---------------

    var d = require('iso-date-to-localdate');

    var date = new Date();

    var convertedisostring = d.datetoisostring(date);  // Output : 2020-07-04T06:52:17.340Z

------------- Convert isodate to local timezone date ----------------

     var d = require('iso-date-to-localdate');
     
     var date = new Date();

     var convertedisostring = d.datetoisostring(date);

     var localtimezonedate = d.isodatetolocaldatetime(convertedisostring, 'MMMM Do YYYY, h:mm:ss a');
     //Output : July 4th 2020, 12:22:17 pm

Note: While convert from iso date to local timezone date we are suppport all datetime format.

Package Sidebar

Install

npm i iso-date-to-localdate

Weekly Downloads

0

Version

1.0.4

License

ISC

Unpacked Size

2.67 kB

Total Files

3

Last publish

Collaborators

  • ronak3445