mirror of
https://github.com/n8n-io/n8n.git
synced 2024-11-12 15:44:06 -08:00
fix(YouTube Node): Fix Date filters (#10725)
Some checks are pending
Test Master / install-and-build (push) Waiting to run
Test Master / Unit tests (18.x) (push) Blocked by required conditions
Test Master / Unit tests (20.x) (push) Blocked by required conditions
Test Master / Unit tests (22.4) (push) Blocked by required conditions
Test Master / Lint (push) Blocked by required conditions
Test Master / Notify Slack on failure (push) Blocked by required conditions
Benchmark Docker Image CI / build (push) Waiting to run
Some checks are pending
Test Master / install-and-build (push) Waiting to run
Test Master / Unit tests (18.x) (push) Blocked by required conditions
Test Master / Unit tests (20.x) (push) Blocked by required conditions
Test Master / Unit tests (22.4) (push) Blocked by required conditions
Test Master / Lint (push) Blocked by required conditions
Test Master / Notify Slack on failure (push) Blocked by required conditions
Benchmark Docker Image CI / build (push) Waiting to run
This commit is contained in:
parent
4f94319cd9
commit
21936c88a8
|
@ -10,6 +10,7 @@ import type {
|
||||||
} from 'n8n-workflow';
|
} from 'n8n-workflow';
|
||||||
import { NodeConnectionType, BINARY_ENCODING, NodeOperationError } from 'n8n-workflow';
|
import { NodeConnectionType, BINARY_ENCODING, NodeOperationError } from 'n8n-workflow';
|
||||||
|
|
||||||
|
import { DateTime } from 'luxon';
|
||||||
import { googleApiRequest, googleApiRequestAllItems } from './GenericFunctions';
|
import { googleApiRequest, googleApiRequestAllItems } from './GenericFunctions';
|
||||||
|
|
||||||
import { channelFields, channelOperations } from './ChannelDescription';
|
import { channelFields, channelOperations } from './ChannelDescription';
|
||||||
|
@ -762,6 +763,28 @@ export class YouTube implements INodeType {
|
||||||
qs.type = 'video';
|
qs.type = 'video';
|
||||||
|
|
||||||
qs.forMine = true;
|
qs.forMine = true;
|
||||||
|
if (filters.publishedAfter) {
|
||||||
|
const publishedAfter = DateTime.fromISO(filters.publishedAfter as string);
|
||||||
|
if (publishedAfter.isValid) {
|
||||||
|
filters.publishedAfter = publishedAfter.setZone(this.getTimezone()).toISO();
|
||||||
|
} else {
|
||||||
|
throw new NodeOperationError(
|
||||||
|
this.getNode(),
|
||||||
|
`The value "${filters.publishedAfter as string}" is not a valid DateTime.`,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (filters.publishedBefore) {
|
||||||
|
const publishedBefore = DateTime.fromISO(filters.publishedBefore as string);
|
||||||
|
if (publishedBefore.isValid) {
|
||||||
|
filters.publishedAfter = publishedBefore.setZone(this.getTimezone()).toISO();
|
||||||
|
} else {
|
||||||
|
throw new NodeOperationError(
|
||||||
|
this.getNode(),
|
||||||
|
`The value "${filters.publishedBefore as string}" is not a valid DateTime.`,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
Object.assign(qs, options, filters);
|
Object.assign(qs, options, filters);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue