From 412d0a19e7cf0214139f6ef9d4c824579adfdb90 Mon Sep 17 00:00:00 2001 From: Louis-Michel Couture Date: Thu, 30 Oct 2025 21:00:17 -0400 Subject: [PATCH] Replace nth_day_of_month with week_of_month The backend expects this string since https://github.com/donetick/donetick/commit/0fa913fb831b47942e8947f85a945799b0fdde25 --- src/views/ChoreEdit/ChoreEdit.jsx | 2 +- src/views/ChoreEdit/RepeatSection.jsx | 8 ++++---- src/views/components/CustomParsers.js | 4 ++-- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/views/ChoreEdit/ChoreEdit.jsx b/src/views/ChoreEdit/ChoreEdit.jsx index 4dd172d..2522bb9 100644 --- a/src/views/ChoreEdit/ChoreEdit.jsx +++ b/src/views/ChoreEdit/ChoreEdit.jsx @@ -161,7 +161,7 @@ const ChoreEdit = () => { // Validate advanced scheduling patterns if ( frequencyType === 'days_of_the_week' && - frequencyMetadata?.weekPattern === 'nth_day_of_month' && + frequencyMetadata?.weekPattern === 'week_of_month' && (!frequencyMetadata?.occurrences || frequencyMetadata.occurrences.length === 0) ) { diff --git a/src/views/ChoreEdit/RepeatSection.jsx b/src/views/ChoreEdit/RepeatSection.jsx index b84e905..5ef70d2 100644 --- a/src/views/ChoreEdit/RepeatSection.jsx +++ b/src/views/ChoreEdit/RepeatSection.jsx @@ -65,7 +65,7 @@ const DAYS = [ const WEEK_PATTERNS = { every_week: 'Every week', - nth_day_of_month: 'Specific occurrences in the month', + week_of_month: 'Specific occurrences in the month', } const DAY_OCCURRENCE_OPTIONS = [ @@ -92,7 +92,7 @@ const generateSchedulePreview = metadata => { } if ( - metadata.weekPattern === 'nth_day_of_month' && + metadata.weekPattern === 'week_of_month' && metadata.occurrences?.length ) { const occurrenceStr = metadata.occurrences @@ -299,7 +299,7 @@ const RepeatOnSections = ({ Task repeats every week on selected days )} - {value === 'nth_day_of_month' && ( + {value === 'week_of_month' && ( Task repeats on specific day occurrences each month (e.g., 1st Monday, 3rd Friday) @@ -309,7 +309,7 @@ const RepeatOnSections = ({ ))} - {frequencyMetadata?.weekPattern === 'nth_day_of_month' && ( + {frequencyMetadata?.weekPattern === 'week_of_month' && ( Select which occurrences of the selected days: diff --git a/src/views/components/CustomParsers.js b/src/views/components/CustomParsers.js index 64691c2..cb4beae 100644 --- a/src/views/components/CustomParsers.js +++ b/src/views/components/CustomParsers.js @@ -430,7 +430,7 @@ export const parseRepeatV2 = inputSentence => { result.frequencyType = 'days_of_the_week' result.frequencyMetadata.days = [VALID_DAYS[dayName].toLowerCase()] - result.frequencyMetadata.weekPattern = 'nth_day_of_month' + result.frequencyMetadata.weekPattern = 'week_of_month' result.frequencyMetadata.occurrences = [occurrence] const startIndex = inputSentence @@ -489,7 +489,7 @@ export const parseRepeatV2 = inputSentence => { result.frequencyType = 'days_of_the_week' result.frequencyMetadata.days = [VALID_DAYS[dayName2].toLowerCase()] - result.frequencyMetadata.weekPattern = 'nth_day_of_month' + result.frequencyMetadata.weekPattern = 'week_of_month' result.frequencyMetadata.occurrences = occurrences const startIndex2 = inputSentence