Browse Source
Bugfix/fix clone functionality of activity (#3678)
* Fix clone functionality
* Update changelog
pull/3679/head
Thomas Kaul
5 months ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with
9 additions and
3 deletions
-
CHANGELOG.md
-
libs/common/src/lib/validator-constraints/is-after-1970.ts
|
|
@ -5,6 +5,12 @@ All notable changes to this project will be documented in this file. |
|
|
|
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), |
|
|
|
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). |
|
|
|
|
|
|
|
## Unreleased |
|
|
|
|
|
|
|
### Fixed |
|
|
|
|
|
|
|
- Fixed an issue with the clone functionality of an activity caused by a changed date format |
|
|
|
|
|
|
|
## 2.104.0 - 2024-08-17 |
|
|
|
|
|
|
|
### Added |
|
|
|
|
|
@ -2,7 +2,7 @@ import { |
|
|
|
ValidatorConstraint, |
|
|
|
ValidatorConstraintInterface |
|
|
|
} from 'class-validator'; |
|
|
|
import { format, isAfter, parseISO } from 'date-fns'; |
|
|
|
import { format, isAfter } from 'date-fns'; |
|
|
|
|
|
|
|
@ValidatorConstraint({ name: 'isAfter1970' }) |
|
|
|
export class IsAfter1970Constraint implements ValidatorConstraintInterface { |
|
|
@ -10,7 +10,7 @@ export class IsAfter1970Constraint implements ValidatorConstraintInterface { |
|
|
|
return `date must be after ${format(new Date(0), 'yyyy')}`; |
|
|
|
} |
|
|
|
|
|
|
|
public validate(aDateString: string) { |
|
|
|
return isAfter(parseISO(aDateString), new Date(0)); |
|
|
|
public validate(aDate: Date) { |
|
|
|
return isAfter(aDate, new Date(0)); |
|
|
|
} |
|
|
|
} |
|
|
|