Time diff NOT WORKING |
(03-24-2024, 04:11 PM)kenjis Wrote: It is recommended to always use UTC in your app, and use local timezone only when displaying date/time. Well, IMHO this implementation is only "correct" if the unit of difference needed is hours (or smaller); the case here is that our unfathomably wise politicians have decided that one specific day has 23 hours (and October 27th will have 25 hours to balance things out for the year). That is, they have redefined what a "day" is (Big Brother style :-). The CI method is CORRECTLY calculating 23 h for this particular interval, what is missing is that it should count as a FULL DAY Any CI user interested in the day difference (which I guess is pretty common, e.g. in my project I just need to show the number of nights spent in a hotel given the arrival and departure dates) is going to be surprised to get a 0 (or a 2) when plugging in two consecutive calendar dates (in fact the glitch will bite you for every date interval that includes one of these 2 special days)... so I believe this should be patched, or at least mentioned in the documentation. Your suggestion to always use UTC project-wise, if my understanding is correct, would render useless some otherwise very convenient functions (https://codeigniter.com/user_guide/libraries/time.html) that are timezone-sensitive... Many thanks |
Messages In This Thread |
Time diff NOT WORKING - by pablo.hernandez - 03-23-2024, 06:25 AM
RE: Time diff NOT WORKING - by kenjis - 03-23-2024, 07:25 PM
RE: Time diff NOT WORKING - by kenjis - 03-24-2024, 02:35 AM
RE: Time diff NOT WORKING - by MaxWho17 - 03-24-2024, 02:53 AM
RE: Time diff NOT WORKING - by bobw - 03-24-2024, 06:12 AM
RE: Time diff NOT WORKING - by kenjis - 03-24-2024, 04:11 PM
RE: Time diff NOT WORKING - by pablo.hernandez - 03-25-2024, 04:15 AM
RE: Time diff NOT WORKING - by kenjis - 03-25-2024, 05:01 PM
RE: Time diff NOT WORKING - by kenjis - 03-25-2024, 05:25 PM
RE: Time diff NOT WORKING - by kenjis - 03-25-2024, 08:10 PM
RE: Time diff NOT WORKING - by pablo.hernandez - 03-26-2024, 10:51 AM
|