Azure / Azure/azure-functions-sql-extension
Offset of DateTimeOffset gets lost in SQL trigger
- Dominant language
- C#
- Stars
- 130
- Forks
- 71
- Avg merge
- 4d 8h
- Merged PRs (30d)
- 4
Description
- Azure Functions SQL Extension or Extension Bundle Version: 3.1.376
- Is this a deployed or local function: deployed (local debugging, same issue)
- What type of Database are you using? Microsoft SQL Azure (RTM) - 12.0.2000.8 Aug 6 2025 10:21:16 Copyright (C) 2025 Microsoft Corporation 5
- List any custom settings for your function app.
```
{
"version": "2.0",
"extensions": {
"Sql": {
"MaxBatchSize": 500,
"PollingIntervalMs": 2500
}
}
}
```
Steps to Reproduce:
1. Add a SQL trigger to a table containing a `DATETIMEOFFSET(7)` column
2. Store a date-time with offset, f.e. "2025-01-01 10:00:00 +07:00"
3. The SQL trigger model, contains the C# type DateTimeOffset to which this column should bind
4. Trigger a change on the row from step 2
5. See that the trigger function receives an incorrect offset (the +07:00 is gone, and things are converted to local time of the system)
6. Also when receiving the changes as JsonObject instead of mapping to our own model, the offset is incorrect
Expected behavior is to receive the original DateTimeOffset as it is stored in the database (including the +07:00 offset), we now need to do an additional query to get the correct value.
Contributor guide
Research direction
Start by tracing the SQL trigger binding for DATETIMEOFFSET(7), comparing the C# DateTimeOffset model path with the JsonObject path described in the reproduction. Verify how the stored +07:00 value is converted and define done as preserving the original offset in both trigger outputs; the payload names no files or tests.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- azure, csharp, sql
- Domain
- backend, databases
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 42/100