-
-
Notifications
You must be signed in to change notification settings - Fork 220
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Today and future data-task-due are messy [date-based CSS errors for non-UTC timezones] #2785
Comments
Thanks for using Tasks. There is content in your screenshots that is not provided as text for me to copy, so for reasons explained in the following post, I am unable to investigate: https://publish.obsidian.md/tasks/Support+and+Help/Report+a+Bug If you can provide full text, and full numbered steps for a reproduction, as per the above, I will willingly have a look when I have time. Thank you. |
It's not content, it's a tasks query using the following code: Today + Past
Tomorrow
Next 7 days
|
Thanks, but I was very clear in #2784 (comment) that I need the task lines in markdown format too. |
Thank you. |
You're more than welcome, I have added an image as well. And sorry for earlier misunderstanding. |
@Hexara7777 Please follow the numbered steps in my reproduction above, and paste the result in here. Thanks. |
Good. Thank you very much. |
You're more than welcome! Do you need any logs or something? |
No, now it is added to my very long list of things to look at, when I have time. |
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. |
I will be out until about 4 PM, can this be a problem? I believe what you're asking about kinda happened around 8 PM yesterday (when I first asked you about this bug). At around 8-10 PM on 26th April, it showed like that (problem with future dates): At around 2-5 AM on 27th April, it showed like that (problem with past dates): I think (just a guess) this whole problem is due to the plugin being dealing with hours since/until past/future days rather than using midnight as the point of truth for which day it's now and what days of past/future are. 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: |
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. |
A couple of things:
|
The relevant code is below. It's interesting that obsidian-tasks/src/Renderer/TaskFieldRenderer.ts Lines 61 to 85 in 21285ea
|
@Hexara7777 - it's OK, you don't need to do any more tests, thanks. I can reproduce the problem in unit tests. |
This edit makes some of the existing tests of Index: tests/global-setup.js
===================================================================
diff --git a/tests/global-setup.js b/tests/global-setup.js
--- a/tests/global-setup.js (revision 21285ea922eb6fb26b9a971504baa72e825217c6)
+++ b/tests/global-setup.js (date 1714199793280)
@@ -1,3 +1,3 @@
module.exports = async () => {
- process.env.TZ = 'UTC';
+ process.env.TZ = 'America/New_York';
}; For example, this:
becomes this:
|
This diff unfortunately did not restore the original behaviour when in 'America/New_York': Index: src/Renderer/TaskFieldRenderer.ts
===================================================================
diff --git a/src/Renderer/TaskFieldRenderer.ts b/src/Renderer/TaskFieldRenderer.ts
--- a/src/Renderer/TaskFieldRenderer.ts (revision 21285ea922eb6fb26b9a971504baa72e825217c6)
+++ b/src/Renderer/TaskFieldRenderer.ts (date 1714201003221)
@@ -60,7 +60,7 @@
function dateToAttribute(date: Moment) {
const today = window.moment().startOf('day');
- const diffDays = today.diff(date, 'days');
+ const diffDays = today.diff(date.startOf('day'), 'days');
if (isNaN(diffDays)) {
return null; So there's a lot more exploration needed. One question to consider is whether the test helper |
I've edited the issue description to add the presumed cause. |
@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. |
@claremacrae You're welcome, I'm glad that you catched the problem, take your time, hope you find the proper solution for it 🙏 |
Possible related issue in another plugin (MIT licence): And solution: |
@claremacrae So, this make its solution easier or sooner to come out? :D |
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.... |
Please check that this issue hasn't been reported before.
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: #2232
As for the timezone its GMT +3, shal
If today's date is 26th, using the following:
Will mark both 26th and 27th as today while it's supposed to mark only "Today".
Will mark 28th as tomorrow while it's supposed to mark 27th as "Tomorrow" instead.
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?
Steps to reproduce
Idk how to
Maintainers note: See #2785 (comment) for steps to reproduce.
Which Operating Systems are you using?
Obsidian Version
1.5.12
Tasks Plugin Version
7.0.0
Checks
Possible solution
Idk
The text was updated successfully, but these errors were encountered: