Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //The variable 'date' contains a Date object chosen from a 'date input', therefore time HH:MM:SS is 00:00:00.
- /*
- This line causes errors when GTM >= +1 due to UTC conversion in ISO standard.
- date -> Fri Feb 09 2018 00:00:00 GMT+0100 (CET)
- date.toISOString -> "2018-02-08T23:00:00.000Z"
- */
- makeRequest(buildUrl(date.toISOString().slice(0,10)));
- /*
- This one may cause some trouble in daylight saving zones at very specific times at days that can have 23 or 25 hours.
- But in our case where we add/substract the time zone offset shouldn't be a problem.(NOT TESTED)
- */
- makeRequest(buildUrl(new Date(date.getTime() + date.getTimezoneOffset()*60*1000*-1).toISOString().slice(0,10)));
- /*
- This can cause problems if not in YYYY-[M]M-[D]D format.
- 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. (?)
- */
- makeRequest(buildUrl(date.toLocaleDateString()));
Add Comment
Please, Sign In to add comment