mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-07-01 15:50:13 +00:00
Merge pull request #34179 from RMHonor/master
[node-cron] Define timezone as a string literal
This commit is contained in:
7
types/node-cron/index.d.ts
vendored
7
types/node-cron/index.d.ts
vendored
@@ -1,9 +1,12 @@
|
||||
// Type definitions for node-cron 2.0
|
||||
// Project: https://github.com/node-cron/node-cron, https://github.com/merencia/node-cron
|
||||
// Definitions by: morsic <https://github.com/maximelkin>,
|
||||
// burtek <https://github.com/burtek>
|
||||
// burtek <https://github.com/burtek>,
|
||||
// Richard Honor <https://github.com/RMHonor>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
import { Timezone } from 'tz-offset';
|
||||
|
||||
export function schedule(cronExpression: string, func: () => void, options?: ScheduleOptions): ScheduledTask;
|
||||
|
||||
export function validate(cronExpression: string): boolean;
|
||||
@@ -24,5 +27,5 @@ export interface ScheduleOptions {
|
||||
/**
|
||||
* The timezone that is used for job scheduling
|
||||
*/
|
||||
timezone?: string;
|
||||
timezone?: Timezone;
|
||||
}
|
||||
|
||||
@@ -45,3 +45,10 @@ const invalid = cron.validate('60 * * * *');
|
||||
if (valid && !invalid) {
|
||||
log('validator works');
|
||||
}
|
||||
|
||||
// check timezones are accepted from the string literal
|
||||
const tast4 = cron.schedule('* * * * *', () => {
|
||||
log('will execute every minute until stopped');
|
||||
}, { timezone: 'Europe/London' });
|
||||
|
||||
tast4.destroy();
|
||||
|
||||
Reference in New Issue
Block a user