V
V
vdorokhin892020-11-26 19:24:50
JavaScript
vdorokhin89, 2020-11-26 19:24:50

How to handle date in js to work on iphones?

It is necessary to calculate the difference in dates - "now" and timestamp from the database.
In fact, quite satisfied with the way

parseInt((new Date() - new Date(timestamp))/(60*60*1000))

But as always with the ill-fated iPhones, you need to invent something - for some reason you can’t set the date on them using new Date("2020-10-10 15:15:15"), it only works with a number in milliseconds. Is it possible to somehow convert the date to milliseconds without three-story splitting into parts and multiplying the components? Or maybe there is another option to pass the date to Date()?
Thanks in advance)

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question