lucasrochagit / nest-mongo-query-parser

A MongoDB query string parser to be used in applications developed with NestJS.
Apache License 2.0
12 stars 8 forks source link

DateTime Validators does not accept october #1

Closed lucasrochagit closed 2 years ago

lucasrochagit commented 2 years ago

In class String Validator:

export class StringValidator {
  public static isInt(str: string): boolean {
    return /^[\d]+$/.test(str);
  }

  public static isNumberString(str: string): boolean {
    return /^[-]?[\d]*\.?[\d]*$/.test(str);
  }

  public static isISODate(str: string): boolean {
    return /^(19[6-9]\d|2\d\d\d)-(0[1-9]|1[1-2])-(0[1-9]|1\d|2\d|3[0-1])$/.test(
      str
    );
  }

  public static isISODateTime(str: string): boolean {
    return /^(19[6-9]\d|2\d\d\d)-(0[1-9]|1[1-2])-(0[1-9]|1\d|2\d|3[0-1])T(0\d|1\d|2[0-3]):([0-5]\d):([0-5]\d).(\d\d\d)(|Z)$/.test(
      str
    );
  }
}

The methods IsISODate and isISODateTime does not accept the october month (10) as valid month.

lucasrochagit commented 2 years ago

Fixed in #d980fe9.