You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Currently, our Jest tests fix the time zone at run-time to `UTC` in [tests/global-setup.js](https://github.com/obsidian-tasks-group/obsidian-tasks/blob/main/tests/global-setup.js).
12
+
13
+
This was done to ensure that the tests pass for contributors all around the world, regardless of their own time zone.
14
+
15
+
## Why we don't use 'moment-timezone'
16
+
17
+
... in `src/`:
18
+
19
+
1. Obsidian plugins are instructed to use `moment` as supplied by Obsidian, to reduce plugin size.
20
+
1.`moment-timezone` increases the Tasks plugin `main.js` size 10-fold, which would slow down start-up time.
21
+
1. So we can't use `moment-timezone` in the released plugin.
22
+
23
+
... in `tests/`:
24
+
25
+
1. The only way to set the timezone dynamically in tests is to use [moment-timezone](https://momentjs.com/timezone/docs/).
26
+
1. But `moment-timezone` modifies the behaviour of `moment`
27
+
1. Which would invalidate any of tests of behaviour that uses `moment`: we could not be confident that the code would behave the same in the released plugin as it does in tests.
28
+
29
+
## Manually testing in different time zones
30
+
31
+
In the absence of automated testing of Tasks in different time zones, see this manual test in the 'Tasks-Demo' vault:
> These instructions assume testing on Mac - hence use of `open` to an Obsidian URL...
5
+
6
+
## Setting up this manual test
7
+
8
+
1. Make sure that you have opened the [Tasks-Demo](https://github.com/obsidian-tasks-group/obsidian-tasks/tree/main/resources/sample_vaults/Tasks-Demo) test vault previously, so that Obsidian knows where that vault is on your computer.
9
+
2. Run the following command
10
+
11
+
```bash
12
+
TZ=Pacific/Auckland open 'obsidian://open?vault=Tasks-Demo&file=Manual%20Testing%2FTime%20Zones%2FPacific-Auckland'
13
+
```
14
+
15
+
3. View this page in Reading or Live Preview mode
16
+
4. Confirm that the headings in the Tasks block are:
17
+
- `Timezone: Pacific/Auckland`
18
+
- `2024-09-28 Saturday`
19
+
20
+
## Run the test
21
+
22
+
1. Complete the task in this file.
23
+
2. Check that the due date of the new task - and the new heading - is '2024-09-28 Sunday'
24
+
25
+
## Tasks Plugin Search
26
+
27
+
```tasks
28
+
not done
29
+
path includes {{query.file.path}}
30
+
31
+
group by function'Timezone:' + process.env.TZ
32
+
group by due
33
+
34
+
hide backlinks
35
+
```
36
+
37
+
## Test task
38
+
39
+
- [ ] #task Next due date should be `2024-09-28 Sunday` 🔁 every day 📅 2024-09-28
40
+
41
+
## Background
42
+
43
+
- This manual test shows the existence of the bug logged in:
44
+
- [Completing a daily recurring task creates task set to same day [the day before Australian clocks switch to daylight savings]](https://github.com/obsidian-tasks-group/obsidian-tasks/issues/2309)
45
+
- It was written to test the behaviour of pull request \#3121:
46
+
- [fix: advance recurring tasks correctly at start of Daylight Savings Time](https://github.com/obsidian-tasks-group/obsidian-tasks/pull/3121)
0 commit comments