Skip to content
This repository was archived by the owner on Jan 11, 2026. It is now read-only.
This repository was archived by the owner on Jan 11, 2026. It is now read-only.

isValidDate does not check single date values #145

Open

Description

@joegasewicz

if (fromDate && toDate) {

I expect this function to work like this:

isValidDate({startDate: "2021-06-1"});
isValidDate({endDate: "2021-06-1"});
isValidDate({startDate: "2021-06-1", endDate: "2021-06-1"});

Activity

  1. xenoworkforce commented on Jun 10, 2021

    @xenoworkforce

    I can do this.

    By the way, this check and other like this will fail in the runtime and will lead to error because typescript check types only on compile / development stage -

    if (!fieldValue) {

  2. joegasewicz commented on Jun 11, 2021

    @joegasewicz
    OwnerAuthor

    @rustmn Please go ahead with this is issue #145, I will look into if (!fieldValue) { btw this is a value check / cohesion to a boolean , not a type check (typeof).
    Thanks

  3. xenoworkforce commented on Jun 11, 2021

    @xenoworkforce

    @joegasewicz ok, I'm about this -

    export const isValidDate: IValidationVariable = customValidator((args: [string, string], fieldValue: Date, _) => {

    You expect fieldValue to be a Date object, you check only if it's value is not null / undefined / false, and then interact with it as it were a Date object -

    if(fieldValue > fromDate && fieldValue < toDate) {

    Some users may pass an empty object and it will not work as expected, I'll fix it.

  4. joegasewicz commented on Jun 11, 2021

    @joegasewicz
    OwnerAuthor

    @rustmn great , go ahead, thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingenhancementNew feature or requestgood first issueGood for newcomershelp wantedExtra attention is needed

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions