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:
@@ -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)
|
||||
|
||||
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user