logic for determining whether a point in time was yesterday is flawed
das-g opened this issue · comments
Bug Description
The logic for determining whether a point in time was yesterday
Line 385 in 39c046f
For days longer than 24 h (i.e., leap seconds and "fall back" out of DST), this doesn't matter, as the lines before it
Lines 381 to 383 in 39c046f
now
.
For days shorter than 24 h (i.e., "spring forward" into DST), this however meant they will incorrectly be "skipped" when looking from a point in time on the next day but less than 24 h after the beginning of said shorter day (i.e. between 0:00 AM and 1:00 AM on the day after the shorter day) back to points in time within that shorter day. Here's a test to demonstrate the problem:
Lines 199 to 213 in a3de764
Europe/Zurich
.
Steps to Reproduce (for bugs)
This problem was found in the source code, not by observing the application behavior. But I guess it could be reproduced like so (untested):
- Be in a timezone that observes DST
- On the day DST begins, send a message.
- On the next day, between 0:00 AM (midnight) and 1:00 AM, look at that message
Expected
The day of the message is displayed as "yesterday".
Observed (speculative, as I didn't test this)
The day of the message is displayed its date.
Potential Solution
Use approach from this Stack Overflow answer instead:
Lines 385 to 386 in a3de764
Your Environment
- Threema Web version: Source code on
master
(39c046f) - Browser name and version: Firefox 84.0 (64-bit)
- Computer operating system and version: NixOS unstable:
- system:
"x86_64-linux"
- host os:
Linux 5.4.85, NixOS, 21.03pre259798.84917aa00bf (Okapi)
- multi-user?:
yes
- sandbox:
yes
- version:
nix-env (Nix) 2.3.10
- channels(root):
"nixos-21.03pre259798.84917aa00bf, nixos-unstable-21.03pre257780.e9158eca70a"
- channels(das-g):
""
- nixpkgs:
/nix/var/nix/profiles/per-user/root/channels/nixos
- system:
Thanks! Note that Threema Web is in maintenance mode, but we'll review pull requests!
Thanks! Note that Threema Web is in maintenance mode, but we'll review pull requests!
I've marked #1014 as "ready for review" now, which turned the draft PR into a PR.
Is
Lines 9 to 10 in 39c046f
Lines 199 to 213 in a3de764