obsidian-tasks: Today and future data-task-due are messy [date-based CSS errors for non-UTC timezones]

Please check that this issue hasn’t been reported before.

  • I searched previous Bug Reports didn’t find any similar reports.

Expected Behavior

Today should translate to Today only and not tomorrow as well All future dates should translate to the exact date not shifted

Current behaviour

Those are from the days remaining CSS snippet: https://github.com/obsidian-tasks-group/obsidian-tasks/discussions/2232 As for the timezone its GMT +3, shal

If today’s date is 26th, using the following:

.contains-task-list .task-due[data-task-due="today"]::after { content: "today" }

Will mark both 26th and 27th as today while it’s supposed to mark only “Today”.

.contains-task-list .task-due[data-task-due="future-1d"]::after { content: "tomorrow" }

Will mark 28th as tomorrow while it’s supposed to mark 27th as “Tomorrow” instead.

.contains-task-list .task-due[data-task-due="future-2d"]::after { content: "in 2 days" }

Will mark 29th as in 2 days although 2 days from 26th is 28th.

And so one for all future dates, all shifted by 1 day. While all past ones works right with no problems.

So, is this some kind of bug? How to fix this?

image

Steps to reproduce

Idk how to

Maintainers note: See https://github.com/obsidian-tasks-group/obsidian-tasks/issues/2785#issuecomment-2080305633 for steps to reproduce.

Which Operating Systems are you using?

  • Android
  • iPhone/iPad
  • Linux
  • macOS
  • Windows

Obsidian Version

1.5.12

Tasks Plugin Version

7.0.0

Checks

  • I have tried it with all other plugins disabled and the error still occurs

Possible solution

Idk

About this issue

Most upvoted comments

@claremacrae So, this make its solution easier or sooner to come out? 😄

Only if somebody has time to write failing tests and then work on it…

Not me, I’m currently swamped with too much other Tasks stuff going on…

@claremacrae You’re welcome, I’m glad that you catched the problem, take your time, hope you find the proper solution for it 🙏 If you need any further testing just tell me right away.

@Hexara7777 Huge thanks for reporting this. I’m so close to UTC/Greenwich Mean Time that I would never have noticed it.

It also reveals a gap in our automated tests that we fix the time zone to UTC, and don’t test in other time zones.

it’s going to take a while to find safe fixes for this, and any related issues we find as a consequence - but it is important to do so.

@Hexara7777 - it’s OK, you don’t need to do any more tests, thanks. I can reproduce the problem in unit tests.

UPDATE: For some reason, dates now @ 5:56 AM on 4/27/2024 GMT+3 are only messy for yesterday and not all of the past dates

A couple of things:

  1. I only spotted this UPDATE by luck. GitHub emails me about new comments, but not about any edits to existing ones. So it’s best to add new info in new comments, instead of editing existing ones.
  2. Had you closed and re-opened all the tabs containing the note before this 5:56 AM observation? Note my recent comment:

You should close the 3 tabs and reopen them each time, to ensure the results are re-rendered.

Yes that’s why I am asking. So far, all the times you’ve quoted are within maybe 4 or 5 hours of your midnight.

I want to know what behaviour you see much closer to your midday.

Also, your changing the clock on your PC introduces another variable or unknown, so I am ignoring any observations made with the clock changed.

Which is why I am asking to know the behaviour close to your actual midday without the clock being changed on your PC.

It’s not a problem your being out today.

Just add the info next time you’re at your PC either side of your midday.

Actually, it would be good to see if the result changes nearer to midday, your time.

Without changing the clock on your PC, could you reopen the test vault at around 11am and again around 1pm, and record the results?

You should close the 3 tabs and reopen them each time, to ensure the results are re-rendered.

And of course paste the result here.

Thanks in advance.

No, now it is added to my very long list of things to look at, when I have time.

Good. Thank you very much.

I see, sorry that’s not what I understood the first time, here they are:

- [ ] 0 📅 2024-04-25
- [ ] 1 📅 2024-04-26
- [ ] 2 📅 2024-04-27
- [ ] 3 📅 2024-04-28 
- [ ] 4 📅 2024-04-29 
- [ ] 5 📅 2024-04-30 
- [ ] 6 📅 2024-05-01
- [ ] 7 📅 2024-05-02
- [ ] 8 📅 2024-05-03
- [ ] 9 📅 2024-05-04

This is the result when I have the current time of 1 AM 27th april as of taking this screenshot: image

And if I manually set my time to 8 PM 26th april (for testing purposes), this is the result: image

It looks like the first task has a past due date and it works fine, for the others, no difference. And 2 consecutive days count as today.