chore: Minor fix
This commit is contained in:
@@ -901,7 +901,11 @@ const matchSpecial = (text, now) => {
|
||||
if (getDay(now) === 5 && isAfter(fri, now)) return fri;
|
||||
return applyTimeToDate(nextFriday(now), 17, 0);
|
||||
}
|
||||
if (eof[1] === 'month') return applyTimeToDate(endOfMonth(now), 17, 0);
|
||||
if (eof[1] === 'month') {
|
||||
const eom = applyTimeToDate(endOfMonth(now), 17, 0);
|
||||
if (isAfter(eom, now)) return eom;
|
||||
return applyTimeToDate(endOfMonth(add(now, { months: 1 })), 17, 0);
|
||||
}
|
||||
}
|
||||
|
||||
if (LATER_TODAY_RE.test(text)) return add(now, { hours: 3 });
|
||||
|
||||
@@ -1100,6 +1100,15 @@ describe('chrono-level patterns', () => {
|
||||
expect(result.date.getDate()).toBe(30);
|
||||
expect(result.date.getHours()).toBe(17);
|
||||
});
|
||||
|
||||
it('"end of month" on last day after 5pm rolls to next month-end', () => {
|
||||
const lastDayLate = new Date('2025-06-30T18:00:00');
|
||||
const result = parseDateFromText('end of month', lastDayLate);
|
||||
expect(result).not.toBeNull();
|
||||
expect(result.date.getMonth()).toBe(6);
|
||||
expect(result.date.getDate()).toBe(31);
|
||||
expect(result.date.getHours()).toBe(17);
|
||||
});
|
||||
});
|
||||
|
||||
describe('later today', () => {
|
||||
|
||||
Reference in New Issue
Block a user