Skip to content

Commit

Permalink
fix: timezone display (#54)
Browse files Browse the repository at this point in the history
# Rationale for this change

Arrow displays inconsistent behavior when instantiating timestamp record
columns which include timezones. It is observed that "00:00" is
interpreted as a valid timezone string by arrow, but "+00:00" is.

# What changes are included in this PR?

This PR simply updates the display impl for timezone to match this
expectation.

# Are these changes tested?

yes
  • Loading branch information
Dustin-Ray authored Jul 22, 2024
1 parent a9c5726 commit bc404ae
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions crates/proof-of-sql-parser/src/posql_time/timezone.rs
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ impl fmt::Display for PoSQLTimeZone {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
match *self {
PoSQLTimeZone::Utc => {
write!(f, "00:00")
write!(f, "+00:00")
}
PoSQLTimeZone::FixedOffset(seconds) => {
let hours = seconds / 3600;
Expand Down Expand Up @@ -91,7 +91,7 @@ mod timezone_parsing_tests {
#[test]
fn test_display_utc() {
let timezone = timezone::PoSQLTimeZone::Utc;
assert_eq!(format!("{}", timezone), "00:00");
assert_eq!(format!("{}", timezone), "+00:00");
}
}

Expand Down

0 comments on commit bc404ae

Please sign in to comment.