iso-date-to-localdate
v1.0.4
Published
This will help to convert date to iso formate and then will help you to retrive iso date to local timezone date
Downloads
10
Maintainers
Readme
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