tustvold commented on code in PR #4748:
URL: https://github.com/apache/arrow-rs/pull/4748#discussion_r1309102326
##########
arrow-cast/src/parse.rs:
##########
@@ -213,28 +211,24 @@ pub fn string_to_datetime<T: TimeZone>(
}
if bytes.len() <= tz_offset {
- let offset = timezone.offset_from_local_datetime(&datetime);
- let offset = offset
+ return timezone
+ .from_local_datetime(&datetime)
.single()
- .ok_or_else(|| err("error computing timezone offset"))?;
- return Ok(DateTime::from_local(datetime, offset));
+ .ok_or_else(|| err("error computing timezone offset"));
}
if bytes[tz_offset] == b'z' || bytes[tz_offset] == b'Z' {
- let offset = timezone.offset_from_local_datetime(&datetime);
- let offset = offset
- .single()
- .ok_or_else(|| err("error computing timezone offset"))?;
- return Ok(DateTime::from_utc(datetime, offset));
+ return Ok(timezone.from_utc_datetime(&datetime));
Review Comment:
It is nice that we now avoid ambiguity in this case - which makes sense as
the UTC time cannot be ambiguous.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]