date - Moment JS setting TimeZone to EST - alloy/moment -
i using momentjs in alloy framework in appcelerator. api returns date - 2017-09-06t12:03:00.000z using below code format date readable form -
var dt = moment(record.createddate); $.datevalue.text = moment(dt).format('lll'); but output - sep 6, 2017 5:33 pm, not correct date saved in db , returned api est , date getting displayed gmt+0530. how should format date correct date value?
i guess, somewhere in code, moment's default timezone set gmt+0530. moment.tz.setdefault('asia/colombo') this.
you can define in timezone want display date. should work :
moment('2017-09-06t12:03:00.000z').tz("etc/gmt").format('lll') or if want value suggested in comments :
moment('2017-09-06t12:03:00.000z').tz("etc/gmt-2").format('lll') for more informations moment.js timezones, can check the moment.js timezone docs.
hope helps !
Comments
Post a Comment