javascripttimestamp2checkout

Invalid Date JS timestamp 2checkout response


2checkout out send this response timestamp: 2019-06-18 05:09:07 EEST

But as I try to validate the date it gives me invalid date.

I've been looking for some timestamps format for I havent got luck.

new Date(2019-06-18 05:09:07 EEST ) <-- invalid

Can anybody help me out how to reformat this date?


Solution

  • Best way I suggest handling dates, even more having in mind timezones, is using something like MomentJS and for the timezone MomentJS Timezone addition Where you could parse the date that you received like let date = moment.tz("2019-06-18 05:09:07", "Timezone") with the appropiate timezone and from there you can format as you want.

    And don't forget, Time is really hard.