• This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn more.

Fixed Relative dates javascript not working at midnight

Jon W

Well-known member
#1
Relative dates seem to be showing the previous day at midnight. This is not consistent with XenForo_Locale and seems to be incorrect.

In xenforo.js (full version), replace:
Code:
                else if (thisTime > today)
                {
                    $element.text(XenForo.phrases.today_at_x
                        .replace(/%time%/, $element.attr('data-timestring'))); // must use attr for string value
                }
                else if (thisTime > yesterday)
                {
                    $element.text(XenForo.phrases.yesterday_at_x
                            .replace(/%time%/, $element.attr('data-timestring'))); // must use attr for string value
                }
                else if (thisTime > week)
with:
Code:
                else if (thisTime >= today)
                {
                    $element.text(XenForo.phrases.today_at_x
                        .replace(/%time%/, $element.attr('data-timestring'))); // must use attr for string value
                }
                else if (thisTime >= yesterday)
                {
                    $element.text(XenForo.phrases.yesterday_at_x
                            .replace(/%time%/, $element.attr('data-timestring'))); // must use attr for string value
                }
                else if (thisTime >= week)
 

Amaury

Well-known member
#2
I'm not sure if this was possibly from the same thing, but I made a thread at precisely 12:00 AM (PT) -- the seconds were still at, like, one -- on another forum on February 6, 2014, wishing someone a happy birthday, and after an hour had passed, it showed Yesterday at 12:00 AM rather than Today at 12:00 AM. So, of course, when it was actually yesterday it showed Thursday at 12:00 AM, though the day was correct.

Only time I experienced it, though. Any other time I've posted at 12:00 AM, it's been fine.
 

Jon W

Well-known member
#3
This is exactly what I'm talking about. I couldn't find an example and couldn't be bothered to stay up until midnight to post!