neilgupta/Sherlock

Asking for a time tomorrow results in nighttime dates

Opened this issue · 0 comments

If I query Sherlock for "tomorrow at 10", I expect 10:00am every time — the first "10:00" that occurs tomorrow.

However, if I ask in the evening, Sherlock will give me 10:00 pm (22:00) instead.

Sherlock._setNow(new Date('2024-10-17T21:00:00'))

Sherlock.parse('tomorrow at 10')
-> {isAllDay: false, eventTitle: null, 
    startDate: Fri Oct 18 2024 22:00:00 GMT-0400 (Eastern Daylight Time),
    endDate: null, validated: true}

If I ask earlier in the morning, I get 10:00 am:

Sherlock._setNow(new Date('2024-10-17T09:00:00'))

Sherlock.parse('tomorrow at 10')
-> {isAllDay: false, eventTitle: null,
    startDate: Fri Oct 18 2024 10:00:00 GMT-0400 (Eastern Daylight Time),
    endDate: null, validated: true}

The evening behavior seems like a bug to me. It also seems risky that I get different results based on the time of day I ask.