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:
@@ -48,6 +48,8 @@ import {
|
||||
databasePageOperations,
|
||||
} from './DatabasePageDescription';
|
||||
|
||||
import * as moment from 'moment-timezone';
|
||||
|
||||
export class Notion implements INodeType {
|
||||
description: INodeTypeDescription = {
|
||||
displayName: 'Notion (Beta)',
|
||||
@@ -266,6 +268,28 @@ export class Notion implements INodeType {
|
||||
const { properties } = await notionApiRequest.call(this, 'GET', `/databases/${databaseId}`);
|
||||
return (properties[name][type].options).map((option: IDataObject) => ({ name: option.name, value: option.id }));
|
||||
},
|
||||
|
||||
// Get all the timezones to display them to user so that he can
|
||||
// select them easily
|
||||
async getTimezones(
|
||||
this: ILoadOptionsFunctions,
|
||||
): Promise<INodePropertyOptions[]> {
|
||||
const returnData: INodePropertyOptions[] = [];
|
||||
for (const timezone of moment.tz.names()) {
|
||||
const timezoneName = timezone;
|
||||
const timezoneId = timezone;
|
||||
returnData.push({
|
||||
name: timezoneName,
|
||||
value: timezoneId,
|
||||
});
|
||||
}
|
||||
returnData.unshift({
|
||||
name: 'Default',
|
||||
value: 'default',
|
||||
description: 'Timezone set in n8n',
|
||||
});
|
||||
return returnData;
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user