Guest User

Untitled

a guest
Feb 22nd, 2018
75
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.92 KB | None | 0 0
  1. //The variable 'date' contains a Date object chosen from a 'date input', therefore time HH:MM:SS is 00:00:00.
  2.  
  3. /*
  4. This line causes errors when GTM >= +1 due to UTC conversion in ISO standard.
  5. date -> Fri Feb 09 2018 00:00:00 GMT+0100 (CET)
  6. date.toISOString -> "2018-02-08T23:00:00.000Z"
  7. */
  8. makeRequest(buildUrl(date.toISOString().slice(0,10)));
  9.  
  10. /*
  11. This one may cause some trouble in daylight saving zones at very specific times at days that can have 23 or 25 hours.
  12. But in our case where we add/substract the time zone offset shouldn't be a problem.(NOT TESTED)
  13. */
  14. makeRequest(buildUrl(new Date(date.getTime() + date.getTimezoneOffset()*60*1000*-1).toISOString().slice(0,10)));
  15.  
  16. /*
  17. This can cause problems if not in YYYY-[M]M-[D]D format.
  18. It's not standardized and depends on the implementation so it may be different in other regions or the implementation can be modified at some point. (?)
  19. */
  20. makeRequest(buildUrl(date.toLocaleDateString()));
Add Comment
Please, Sign In to add comment