0

I am receiving a datetime value from backend with and need to convert it to the Date object

The format of the datetime value is 2021-12-12 11:30 AM

I tried using this code which only works in Chrome, but gives "invalid date" error in Firefox

new Date('2021-12-12 11:30 AM')

My end goal is to calculate time past from the given date. I was using moment.js for this, but that doesn't work on Firefox. I have been searching online for solutions but no luck yet.

Any help would be appreciated. Thanks

Tahreem Iqbal
  • 895
  • 6
  • 16
  • 40

0 Answers0