Skip to content

forwardDate: false doesn't force the past like forwardDate: true forces the future #599

@shawn-guenther

Description

@shawn-guenther

I'm using chrono-node to let people search for logs by date, so anything they search for is in the past. Nothin future at all. I assumed that forwardDate: false with a reference date of today would accomplish this, but it does not.

If, on Monday, I do parseDate("Friday", new Date(), { forwardDate: false }) it gives me Friday of the current week: 4 days in the future.

If I search "last Friday" it gets it right, or if I shift the reference date to last week it gets it right, but from a usability perspective that's not great. I am taking a search string from a user, so now I have to do something like parse the date, if it's in the future, roll the reference back a week and try again. I can't just statically roll the reference date back because then it gives me the wrong dates for the current week.

Would be great if forwardDate: false actually forced all dates to be prior to reference date.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions