Azure / Azure/azure-functions-host

Timer trigger being interpreted in local time zone through local emulator

Open
#5,865 8 comments 0 reactions 1 assignee Claimed by @v-bbalaiagar View on GitHub
bug needs-investigation
Dominant language
C#
Stars
2k
Forks
482
Avg merge
2d 12h
Merged PRs (30d)
38

Description

#### Check for a solution in the Azure portal

- Function App version: 3.0.13139.0
- Function App name: N/A
- Invocation ID: N/A
- Region: N/A

#### Repro steps
I just found out that the Functions emulator interprets a cron expression in a timer trigger in the local time zone. I have a function with the following expression: `0 0 1,6,15,20 * * *`. When I run it locally, the emulator shows this:

```
[4/6/2020 11:09:08 PM] The next 5 occurrences of the 'MetricPlatformAlertFunction' schedule (Cron: '0 0 1,6,15,20 * * *') will be:
[4/6/2020 11:09:08 PM] 04/06/2020 20:00:00-07:00 (04/07/2020 03:00:00Z)
[4/6/2020 11:09:08 PM] 04/07/2020 01:00:00-07:00 (04/07/2020 08:00:00Z)
[4/6/2020 11:09:08 PM] 04/07/2020 06:00:00-07:00 (04/07/2020 13:00:00Z)
[4/6/2020 11:09:08 PM] 04/07/2020 15:00:00-07:00 (04/07/2020 22:00:00Z)
[4/6/2020 11:09:08 PM] 04/07/2020 20:00:00-07:00 (04/08/2020 03:00:00Z)
```

According to the [documentation](https://docs.microsoft.com/en-us/azure/azure-functions/functions-bindings-timer?tabs=csharp), cron expressions are interpreted in UTC by default, and I don't have `WEBSITE_TIME_ZONE` set anywhere in my solution. I don't know if this is the expected behavior for the emulator, but the fact that it doesn't reflect the production behavior is confusing in my opinion.

#### Expected behavior
The trigger should be invoked at 1h, 6h, 15h and 20h UTC, not local (UTC-7).

#### Actual behavior
The trigger gets invoked at 1h, 6h, 15h and 20h UTC-7.

#### Additional information
When deployed to Azure and in an app service plan, the expression gets interpreted in UTC time.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.