MCPcopy Create free account
hub / github.com/apache/arrow-rs / string_to_timestamp_chrono

Function string_to_timestamp_chrono

arrow-cast/src/parse.rs:1635–1672  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

1633
1634 #[test]
1635 fn string_to_timestamp_chrono() {
1636 let cases = [
1637 "2020-09-08T13:42:29Z",
1638 "1969-01-01T00:00:00.1Z",
1639 "2020-09-08T12:00:12.12345678+00:00",
1640 "2020-09-08T12:00:12+00:00",
1641 "2020-09-08T12:00:12.1+00:00",
1642 "2020-09-08T12:00:12.12+00:00",
1643 "2020-09-08T12:00:12.123+00:00",
1644 "2020-09-08T12:00:12.1234+00:00",
1645 "2020-09-08T12:00:12.12345+00:00",
1646 "2020-09-08T12:00:12.123456+00:00",
1647 "2020-09-08T12:00:12.1234567+00:00",
1648 "2020-09-08T12:00:12.12345678+00:00",
1649 "2020-09-08T12:00:12.123456789+00:00",
1650 "2020-09-08T12:00:12.12345678912z",
1651 "2020-09-08T12:00:12.123456789123Z",
1652 "2020-09-08T12:00:12.123456789123+02:00",
1653 "2020-09-08T12:00:12.12345678912345Z",
1654 "2020-09-08T12:00:12.1234567891234567+02:00",
1655 "2020-09-08T12:00:60Z",
1656 "2020-09-08T12:00:60.123Z",
1657 "2020-09-08T12:00:60.123456+02:00",
1658 "2020-09-08T12:00:60.1234567891234567+02:00",
1659 "2020-09-08T12:00:60.999999999+02:00",
1660 "2020-09-08t12:00:12.12345678+00:00",
1661 "2020-09-08t12:00:12+00:00",
1662 "2020-09-08t12:00:12Z",
1663 ];
1664
1665 for case in cases {
1666 let chrono = DateTime::parse_from_rfc3339(case).unwrap();
1667 let chrono_utc = chrono.with_timezone(&Utc);
1668
1669 let custom = string_to_datetime(&Utc, case).unwrap();
1670 assert_eq!(chrono_utc, custom)
1671 }
1672 }
1673
1674 #[test]
1675 fn string_to_timestamp_naive() {

Callers

nothing calls this directly

Calls 2

string_to_datetimeFunction · 0.85
with_timezoneMethod · 0.45

Tested by

no test coverage detected