mirror of
https://github.com/Abdulazizzn/n8n-enterprise-unlocked.git
synced 2025-12-17 10:02:05 +00:00
fix(Date & Time Node): Dont parse date if it's not set (null or undefined) (#7050)
Github issue / Community forum post (link here to close automatically): https://community.n8n.io/t/date-time-node-transforming-null-to-19700101/29339 null/undefined input was converted to 01/01/1970 instead of being passed through as-is
This commit is contained in:
@@ -134,18 +134,24 @@ export class DateTimeV2 implements INodeType {
|
||||
const outputFieldName = this.getNodeParameter('outputFieldName', i) as string;
|
||||
const { timezone } = this.getNodeParameter('options', i) as { timezone: boolean };
|
||||
|
||||
const dateLuxon = timezone
|
||||
? parseDate.call(this, date, workflowTimezone)
|
||||
: parseDate.call(this, date);
|
||||
if (format === 'custom') {
|
||||
const customFormat = this.getNodeParameter('customFormat', i) as string;
|
||||
if (date === null || date === undefined) {
|
||||
responseData.push({
|
||||
[outputFieldName]: dateLuxon.toFormat(customFormat),
|
||||
[outputFieldName]: date,
|
||||
});
|
||||
} else {
|
||||
responseData.push({
|
||||
[outputFieldName]: dateLuxon.toFormat(format),
|
||||
});
|
||||
const dateLuxon = timezone
|
||||
? parseDate.call(this, date, workflowTimezone)
|
||||
: parseDate.call(this, date);
|
||||
if (format === 'custom') {
|
||||
const customFormat = this.getNodeParameter('customFormat', i) as string;
|
||||
responseData.push({
|
||||
[outputFieldName]: dateLuxon.toFormat(customFormat),
|
||||
});
|
||||
} else {
|
||||
responseData.push({
|
||||
[outputFieldName]: dateLuxon.toFormat(format),
|
||||
});
|
||||
}
|
||||
}
|
||||
} else if (operation === 'roundDate') {
|
||||
const date = this.getNodeParameter('date', i) as string;
|
||||
|
||||
Reference in New Issue
Block a user