-
-
Notifications
You must be signed in to change notification settings - Fork 930
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: refactor to make CVE date range user editable
- Loading branch information
1 parent
ac78f58
commit d34d3b0
Showing
3 changed files
with
30 additions
and
20 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
/** | ||
* Converts date passed as a string, number or Date to a Date object. | ||
* If nothing or a non parseable value is passed, takes current date. | ||
* | ||
* @param date Date | ||
*/ | ||
export function toDate(date?: string | Date | number): Date { | ||
date = new Date(date); | ||
if (isNaN(date.valueOf())) { | ||
date = new Date(); | ||
} | ||
|
||
return date; | ||
} |
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