You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
unparser: use to_rfc3339 for TIMESTAMPTZ formatting #21294
As discussed here the unparser default behavior is to use DateTime<Tz>.to_string() to unparse timestamp with time zone values, which produce literals not supported by multiple dialects (eg DuckDB, BigQuery).
We should switch to DateTime<Tz>.to_rfc3339 as the default formatting, which produces a valid ISO 8601 / RFC 3339 timestamp string and is more broadly compatible across dialects.
/// Returns an RFC 3339 and ISO 8601 date and time string such as `1996-12-19T16:39:57-08:00`.
#[cfg(feature = "alloc")]
#[must_use]
pub fn to_rfc3339(&self) -> String {
// For some reason a string with a capacity less than 32 is ca 20% slower when benchmarking.
let mut result = String::with_capacity(32);
let naive = self.overflowing_naive_local();
let offset = self.offset.fix();
write_rfc3339(&mut result, naive, offset, SecondsFormat::AutoSi, false)
.expect("writing rfc3339 datetime to string should never fail");
result
}
Activity
sgrebnov commentedon Apr 1, 2026
take
fix(unparser): use to_rfc3339 for default TIMESTAMPTZ formatting (#21295
fix(unparser): use to_rfc3339 for default TIMESTAMPTZ formatting (apa…