mirror of
https://github.com/Abdulazizzn/n8n-enterprise-unlocked.git
synced 2025-12-17 18:12:04 +00:00
fix(YouTube Node): Issue in published before and after dates filters (#11741)
This commit is contained in:
@@ -1,16 +1,18 @@
|
||||
import type {
|
||||
IExecuteFunctions,
|
||||
ILoadOptionsFunctions,
|
||||
ICredentialTestFunctions,
|
||||
IDataObject,
|
||||
IPollFunctions,
|
||||
IRequestOptions,
|
||||
import {
|
||||
type IExecuteFunctions,
|
||||
type ILoadOptionsFunctions,
|
||||
type ICredentialTestFunctions,
|
||||
type IDataObject,
|
||||
type IPollFunctions,
|
||||
type IRequestOptions,
|
||||
NodeOperationError,
|
||||
} from 'n8n-workflow';
|
||||
|
||||
import moment from 'moment-timezone';
|
||||
import * as jwt from 'jsonwebtoken';
|
||||
|
||||
import { formatPrivateKey } from '@utils/utilities';
|
||||
import { DateTime } from 'luxon';
|
||||
|
||||
const googleServiceAccountScopes = {
|
||||
bigquery: ['https://www.googleapis.com/auth/bigquery'],
|
||||
@@ -110,3 +112,20 @@ export async function getGoogleAccessToken(
|
||||
|
||||
return await this.helpers.request(options);
|
||||
}
|
||||
|
||||
export function validateAndSetDate(
|
||||
filter: IDataObject,
|
||||
key: string,
|
||||
timezone: string,
|
||||
context: IExecuteFunctions,
|
||||
) {
|
||||
const date = DateTime.fromISO(filter[key] as string);
|
||||
if (date.isValid) {
|
||||
filter[key] = date.setZone(timezone).toISO();
|
||||
} else {
|
||||
throw new NodeOperationError(
|
||||
context.getNode(),
|
||||
`The value "${filter[key] as string}" is not a valid DateTime.`,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user