mirror of
https://github.com/Abdulazizzn/n8n-enterprise-unlocked.git
synced 2025-12-17 10:02:05 +00:00
⚡ Add timezone support to date type field in Notion (#2082)
* Add timezone in date property on Notion Signed-off-by: 5pecia1 <pdpxpd@gmail.com> * ⚡ Improvements to #2036 * ⚡ Minor improvements Co-authored-by: 5pecia1 <pdpxpd@gmail.com> Co-authored-by: Jan Oberhauser <jan.oberhauser@gmail.com>
This commit is contained in:
@@ -284,13 +284,22 @@ function getPropertyKeyValue(value: any, type: string, timezone: string) {
|
||||
break;
|
||||
case 'date':
|
||||
const format = getDateFormat(value.includeTime);
|
||||
const timezoneValue = (value.timezone === 'default') ? timezone : value.timezone;
|
||||
if (value.range === true) {
|
||||
result = {
|
||||
type: 'date', date: { start: moment.tz(value.dateStart, timezone).format(format), end: moment.tz(value.dateEnd, timezone).format(format) },
|
||||
type: 'date',
|
||||
date: {
|
||||
start: moment.tz(value.dateStart, timezoneValue).format(format),
|
||||
end: moment.tz(value.dateEnd, timezoneValue).format(format),
|
||||
},
|
||||
};
|
||||
} else {
|
||||
result = {
|
||||
type: 'date', date: { start: moment.tz(value.date, timezone).format(format), end: null },
|
||||
type: 'date',
|
||||
date: {
|
||||
start: moment.tz(value.date, timezoneValue).format(format),
|
||||
end: null,
|
||||
},
|
||||
};
|
||||
}
|
||||
break;
|
||||
@@ -350,7 +359,7 @@ export function mapFilters(filters: IDataObject[], timezone: string) {
|
||||
} else if (key === 'date' && !['is_empty', 'is_not_empty'].includes(value.condition as string)) {
|
||||
valuePropertyName = (valuePropertyName !== undefined && !Object.keys(valuePropertyName).length) ? {} : moment.tz(value.date, timezone).utc().format();
|
||||
}
|
||||
|
||||
|
||||
return Object.assign(obj, {
|
||||
['property']: getNameAndType(value.key).name,
|
||||
[key]: { [`${value.condition}`]: valuePropertyName },
|
||||
|
||||
Reference in New Issue
Block a user