mirror of
https://github.com/n8n-io/n8n.git
synced 2026-06-04 02:37:46 +02:00
13 lines
327 B
TypeScript
13 lines
327 B
TypeScript
import moment from 'moment-timezone';
|
|
|
|
export function parseToTimestamp(dateString: unknown): number {
|
|
if (typeof dateString !== 'string') {
|
|
throw new Error('Invalid date string');
|
|
}
|
|
const timestamp = moment(dateString).valueOf();
|
|
if (isNaN(timestamp)) {
|
|
throw new Error('Invalid date string');
|
|
}
|
|
return timestamp;
|
|
}
|