Browse Source
Bugfix/year in validation message of date (#8028)
Fix year in validation message of date
pull/7984/head^2
Thomas Kaul
5 days ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with
2 additions and
1 deletions
-
libs/common/src/lib/validator-constraints/is-after-1970.ts
|
|
@ -1,5 +1,6 @@ |
|
|
import { isValidDateAfter1970 } from '@ghostfolio/common/helper'; |
|
|
import { isValidDateAfter1970 } from '@ghostfolio/common/helper'; |
|
|
|
|
|
|
|
|
|
|
|
import { utc } from '@date-fns/utc'; |
|
|
import { |
|
|
import { |
|
|
ValidatorConstraint, |
|
|
ValidatorConstraint, |
|
|
ValidatorConstraintInterface |
|
|
ValidatorConstraintInterface |
|
|
@ -9,7 +10,7 @@ import { format } from 'date-fns'; |
|
|
@ValidatorConstraint({ name: 'isAfter1970' }) |
|
|
@ValidatorConstraint({ name: 'isAfter1970' }) |
|
|
export class IsAfter1970Constraint implements ValidatorConstraintInterface { |
|
|
export class IsAfter1970Constraint implements ValidatorConstraintInterface { |
|
|
public defaultMessage() { |
|
|
public defaultMessage() { |
|
|
return `date must be after ${format(new Date(0), 'yyyy')}`; |
|
|
return `date must be after ${format(new Date(0), 'yyyy', { in: utc })}`; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
public validate(aDate: Date | string) { |
|
|
public validate(aDate: Date | string) { |
|
|
|