mirror of
https://github.com/cpvalente/ontime.git
synced 2026-08-06 07:53:54 +00:00
refactor: handle unexpected data types
This commit is contained in:
@@ -89,7 +89,11 @@ export const forgivingStringToMillis = (value: string, fillLeft = true): number
|
||||
* @returns {number} - time in milliseconds
|
||||
|
||||
*/
|
||||
export const parseExcelDate = (excelDate: string): number => {
|
||||
export const parseExcelDate = (excelDate: unknown): number => {
|
||||
if (typeof excelDate !== 'string') {
|
||||
return 0;
|
||||
}
|
||||
|
||||
// attempt converting to date object
|
||||
const date = new Date(excelDate);
|
||||
if (date instanceof Date && !isNaN(date.getTime())) {
|
||||
|
||||
Reference in New Issue
Block a user