Skip to content

Commit 68ed913

Browse files
authored
Merge pull request #3348 from obsidian-tasks-group/fix-ios-date-picker-reading-mode
fix: Reinstate date picker on iPhone - week starts on Monday
2 parents 4ca8fe6 + 9d46532 commit 68ed913

File tree

2 files changed

+5
-12
lines changed

2 files changed

+5
-12
lines changed

docs/Editing/Editing Dates.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,8 @@ There is a [[#Date-picker on task dates]] and a [[#Context menu on task dates]],
3535
| In Tasks query search results | Live Preview ||
3636
| In Tasks query search results | Reading mode ||
3737

38+
On iPhone, and probably iPad too, this date-picker hard-codes the start of the week to Monday, instead of respecting the user's settings. We are tracking this in [issue #3239](https://github.com/obsidian-tasks-group/obsidian-tasks/issues/3239).
39+
3840
## Context menu on task dates
3941

4042
> [!released]

src/ui/Menus/DatePicker.ts

Lines changed: 3 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -20,24 +20,15 @@ export function promptForDate(
2020
const currentValue = task[dateFieldToEdit];
2121
// TODO figure out how Today's date is determined: if Obsidian is left
2222
// running overnight, the flatpickr modal shows the previous day as Today.
23-
// Try to determine the first day of the week based on the locale, or use Monday
24-
// if unavailable
25-
const weekInfo = (new Intl.Locale(navigator.language) as any).weekInfo;
26-
console.log(`promptForDate(): weekInfo: ${JSON.stringify(weekInfo, null, 4)}`);
27-
28-
const firstDayOfWeekFromLocale = weekInfo.firstDay;
29-
console.log(`promptForDate(): firstDayOfWeekFromLocale: ${firstDayOfWeekFromLocale}`);
30-
31-
const firstDayOfWeek = firstDayOfWeekFromLocale ?? 1;
32-
console.log(`promptForDate(): firstDayOfWeek: ${firstDayOfWeek}`);
33-
3423
const fp = flatpickr(parentElement, {
3524
defaultDate: currentValue ? currentValue.format('YYYY-MM-DD') : new Date(),
3625
disableMobile: true,
3726
enableTime: false, // Optional: Enable time picker
3827
dateFormat: 'Y-m-d', // Adjust the date and time format as needed
3928
locale: {
40-
firstDayOfWeek: firstDayOfWeek,
29+
// Try to determine the first day of the week based on the locale, or use Monday
30+
// if unavailable
31+
firstDayOfWeek: (new Intl.Locale(navigator.language) as any).weekInfo?.firstDay ?? 1,
4132
},
4233
onClose: async (selectedDates, _dateStr, instance) => {
4334
if (selectedDates.length > 0) {

0 commit comments

Comments
 (0)