mirror of
https://github.com/n8n-io/n8n.git
synced 2025-03-05 20:50:17 -08:00
Fix Format date operation
This commit is contained in:
parent
e67d2d5854
commit
951ef699f8
|
@ -122,11 +122,11 @@ export class DateTimeV2 implements INodeType {
|
|||
if (format === 'custom') {
|
||||
const customFormat = this.getNodeParameter('customFormat', i) as string;
|
||||
responseData.push({
|
||||
[outputFieldName]: DateTime.fromFormat(dateLuxon.toISO(), customFormat),
|
||||
[outputFieldName]: dateLuxon.toFormat(customFormat),
|
||||
});
|
||||
} else {
|
||||
responseData.push({
|
||||
[outputFieldName]: DateTime.fromFormat(dateLuxon.toISO(), format),
|
||||
[outputFieldName]: dateLuxon.toFormat(format),
|
||||
});
|
||||
}
|
||||
} else if (operation === 'roundDate') {
|
||||
|
|
|
@ -7,12 +7,10 @@ export function parseDate(this: IExecuteFunctions, date: string | DateTime, time
|
|||
let parsedDate;
|
||||
|
||||
if (date instanceof DateTime) {
|
||||
console.log('date is a DateTime object');
|
||||
parsedDate = date;
|
||||
} else {
|
||||
parsedDate = DateTime.fromISO(moment.tz(date, timezone).toISOString());
|
||||
if (parsedDate.invalidReason === 'unparsable') {
|
||||
console.log(parsedDate.invalidReason);
|
||||
throw new NodeOperationError(this.getNode(), 'Invalid date format');
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue