mirror of
https://github.com/n8n-io/n8n.git
synced 2025-03-05 20:50:17 -08:00
15 lines
339 B
TypeScript
15 lines
339 B
TypeScript
import { DateTime } from 'luxon';
|
|
import moment from 'moment';
|
|
|
|
export function parseDate(date: string | DateTime, timezone: string) {
|
|
let parsedDate;
|
|
|
|
if (date instanceof DateTime) {
|
|
parsedDate = date;
|
|
console.log('here');
|
|
} else {
|
|
parsedDate = DateTime.fromISO(moment.tz(date, timezone).toISOString());
|
|
}
|
|
return parsedDate;
|
|
}
|