Changelog #66

·

Scheduled task timezone support

Matt Aitken

Matt Aitken

CEO, Trigger.dev

Image forScheduled task timezone support

We've added timezone support for scheduled tasks in the latest v3 SDK version: 3.0.0-beta.39. This means you can schedule tasks in specific timezones and it automatically adjusts for Daylight Saving Time.

We've also made it compulsory to use a deduplicationKey when creating a schedule in code, and introduced some limits to the number of schedules you can create.

Run this command in your repo to easily upgrade:


_10
npx trigger.dev@beta update

Timezones

When you create a schedule you can specify the timezone in IANA format, or leave it as UTC.

Examples of IANA timezones are America/New_York, Europe/London, Asia/Tokyo, etc.

If you specify one of these then the schedule will automatically adjust when Daylight Saving Time starts and ends.

This is especially useful if you're scheduling tasks for your users. We've also added an SDK function to get all the possible timezones, this can be used to show a dropdown in your UI.


_10
const timezones = await schedules.timezones();

In the dashboard

When creating a schedule in the dashboard you can specify the timezone:

Trigger.dev dashboard

Everywhere in the dashboard where we show schedules we show the timezone (default is "UTC") and the time of the last and next run in that timezone.

Deduplication key and limits

We strongly recommend you create non-dynamic schedules in the dashboard UI. It means it's easier to toggle environments on and off and won't be confusing when your code doesn't match the state in the dashboard.

We've made a change to the SDK so that we now require you to provide a deduplicationKey when creating a schedule in code. If you use the same deduplicationKey more than once it will update the schedule rather than creating a new one. This is to prevent you from accidentally creating multiple schedules for the same task. There were several users who created thousands of duplicate schedules because they were running the create schedule code when their app started.

We've also introduced some limits to the number of schedules you can create. The free limit is 5 schedules. Paid plans will have higher limits when they launch next month. For now, you can request more on the schedules page. We've temporarily increased the limits for existing users who were already over 5 and didn't have lots of duplicates.

Ready to start building?

Build and deploy your first task in 3 minutes.

Get started now
,