Update due date handling to treat 23:59:59 as end-of-day and adjust parsing logic for unspecified times

This commit is contained in:
Mo Tarbin
2026-04-05 20:27:07 -04:00
parent 629920c2b3
commit 65cba31306
2 changed files with 11 additions and 3 deletions

View File

@@ -25,8 +25,8 @@ export const getDueDateChipText = (nextDueDate, chore) => {
const dueDate = moment(nextDueDate)
const diff = moment(nextDueDate).diff(moment(), 'hours')
// if seconds and minutes set to 59, treat as no time (date only)
if (dueDate.seconds() === 59 && dueDate.minutes() === 59) {
// if time is 23:59:59, treat as end-of-day (date only, no specific time)
if (dueDate.hours() === 23 && dueDate.minutes() === 59 && dueDate.seconds() === 59) {
if (diff < 0) {
// For overdue dates, show calendar format for recent dates
const absDiff = Math.abs(diff)

View File

@@ -722,8 +722,16 @@ export const parseDueDate = (inputSentence, chrono) => {
.replace(/\s+/g, ' ') // Replace multiple spaces with single space
.trim()
// If no specific time was mentioned, set to end of day (23:59:59)
// to indicate the date has no specific time tied to it (same convention as ChoreEdit)
let resultDate = dueDateMatch.start.date()
if (!dueDateMatch.start.isCertain('hour')) {
resultDate = new Date(resultDate)
resultDate.setHours(23, 59, 59, 0)
}
return {
result: dueDateMatch.start.date(),
result: resultDate,
highlight: [
{
text: fullHighlightText,