1. 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

Discussion in 'Resolved Bug Reports' started by Jon W, Jan 6, 2015.

  1. Jon W

    Jon W Well-Known Member

    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)
    
     
    Alluidh likes this.
  2. Amaury

    Amaury Well-Known Member

    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 likes this.
  3. Jon W

    Jon W Well-Known Member

    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!
     
    Amaury likes this.
  4. Mike

    Mike XenForo Developer Staff Member

    Note that this would apply only at 00:00:00 -- it's really juts an off by one error.

    Changed now, thanks.
     
    Amaury and Jon W like this.

Share This Page