-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: unambiguously truncate time in date_trunc function (#9068)
* fix: unambiguously truncate time in date_trunc function When date_trunc is truncating a timestamp with a geographic timezone it would previously get stuck if the local reprentation of the time could be ambiguously interpretted. This happens when the clocks "go back". The update here is to use the original timestamp offset as the tie-breaker when the local representation of the truncated time could be ambiguous. * fix: fmt * chore: review suggestion * fix: fmt * Add date_trunc test to slt * Update test for fixed fode * feat: additional tests Add test for the historical America/Sao_Paulo timezone which changed in and out of DST at midnight. * chore: review suggestion * fix: date_trunc support days starting at 1am Historically Sao Paulo, and possibly other places, have had daylight savings time that started at midnight. This causes the day to start at 1am. The naive method used by date_trunc to truncate to 'day' will create a non-existent time in these circumstances. Adjust the timestamps produced by date_trunc in this case to be valid within the required timezone. * fix: fmt --------- Co-authored-by: Andrew Lamb <andrew@nerdnetworks.org>
- Loading branch information
Showing
2 changed files
with
400 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.