Uploaded image for project: 'phpBB'
  1. phpBB
  2. PHPBB-16715

user time zone bug

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Cannot Reproduce
    • Icon: Major Major
    • None
    • 3.3.3
    • Build System
    • None

      Hello!

      Unfortunately, $this->user->format_date does not respond correctly to all timestamps.

      I created two example timestamps (2021-03-28 00:00 - 1616886000 and 2021-03-31 23:59 - 1617231540).

      The

      $this->user->format_date(1616886000, 'Y-m-d H: i', true);

      return correct value :: 2021-03-28 00:00

      The

      $this->user->format_date(1617231540, 'Y-m-d H: i', true);

      return incorrect value :: 2021-04-01 00:59

      If I subtract the timestamps from the other 1617231540 - 1616886000 = 345540/60 = 5759 min = 3 days 23 hours and 59 minutes

      2021-03-28 00:00 + 3 days 23 hours and 59 minutes = 2021-03-31 23:59

      So 2021-04-01 00:59 is a really wrong value.

      If use the

      date('Y-m-d H: i', 1617231540 + $this->user->timezone->getOffset(new \ DateTime));

      then add back display correct date 2021-03-31 23:59

      So only the $this->user->format_date function is faulty.

      My PHP 7.4 and phpBB 3.3.3 setting: Europe/Budapest

      I would ask you to investigate this, thank you in advance.

            Marc Marc
            KillBill. KillBill.
            Votes:
            1 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: