Tell me how to check the date in ISO format, that it lies in the interval between today's date and a certain date in the future on the server? how to consider all time zones

eg

21:57 Tuesday, May 22, 2018 (GMT + 3) Moscow

0:57 Wednesday, May 23, 2018 (GMT + 6) Omsk, Omsk Region

these dates are the same

and also time. if today is not less than the current time

that is, the user somewhere in Omsk sent on May 21 at 21:05, then I need to compare this date and this time in the interval between today's date and 09/21/18, for example, and even if it is today, then check the time. whether the time is greater than its current time or not. if he entered 21:50 and sent to the back, and now he has 21:55, then this time is already invalid

The date comes in back in ISO format. Find out the current date on the back. Compare that the incoming date lies between today and 09/21/18 and if today's date, then compare the time that has come. It should be no less than the time of the current user. If the user sent 21:50 at home, and now he has 21:26, then this is invalid

  • momentjs.com/docs - nörbörnën
  • So you yourself say that you have dates in ISO format, why not just do something like d = new Date(ISODateString) , and then compare with anything? Ambiguity something should not arise. - Yaant
  • and how do I know the current date? if i just do new date () on the server, is that normal? - werty
  • and how to translate the date 09/21/18 in ISO? time must also be taken into account - werty
  • That is, the algorithm is as follows: 1. I get the date from the front, and I make new Date (ISODateString) 2. I get the current date on the server. Just new Date () 3. translate '21 .09.18 'into new Date () on server 3. using a moment or date-fns, do I compare if there is a time between new Date and 09/21/18? - werty

0