-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add verification date cutoff (#2383)
Co-authored-by: Angel Montenegro <[email protected]>
- Loading branch information
1 parent
68e1757
commit a844d6c
Showing
6 changed files
with
50 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
8 changes: 8 additions & 0 deletions
8
src/app/shared/pipes/verification-date-cutoff-pipe/verification-date-cutoff.pipe.spec.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
import { VerificationDateCutoffPipe } from './verification-date-cutoff.pipe' | ||
|
||
describe('VerificationDateCutoffPipe', () => { | ||
it('create an instance', () => { | ||
const pipe = new VerificationDateCutoffPipe() | ||
expect(pipe).toBeTruthy() | ||
}) | ||
}) |
17 changes: 17 additions & 0 deletions
17
src/app/shared/pipes/verification-date-cutoff-pipe/verification-date-cutoff.pipe.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
import { Pipe, PipeTransform } from '@angular/core' | ||
import { VERIFICATION_DATE_CUTOFF } from 'src/app/constants' | ||
|
||
@Pipe({ | ||
name: 'verificationDateCutoff', | ||
}) | ||
export class VerificationDateCutoffPipe implements PipeTransform { | ||
transform(value: string): string | null { | ||
if (typeof value === 'string') { | ||
const date = new Date(value) | ||
if (date >= VERIFICATION_DATE_CUTOFF) { | ||
return value | ||
} | ||
} | ||
return null | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters