Skip to content

Commit

Permalink
Fix parsing RFC3339 strings
Browse files Browse the repository at this point in the history
Signed-off-by: Matthias Wahl <matthiaswahl@m7w3.de>
  • Loading branch information
mfelsche authored and Licenser committed Apr 23, 2023
1 parent d0ff561 commit 04c0d6d
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 2 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@

## Unreleased

### Fixes

* Fix parsing with `std::datetime::formats::RFC3339` to allow for `Z` (zulu) timezones.

### New features

* Add configuration option `path_style_access` to `s3_streamer` and `s3_reader` connectors.
Expand Down
18 changes: 17 additions & 1 deletion tremor-cli/tests/stdlib/std/all.tremor
Original file line number Diff line number Diff line change
Expand Up @@ -815,9 +815,25 @@ test::suite({
"test": test::assert("datetime::with_timezone", datetime::with_timezone({"timestamp": 0, "tz": datetime::timezones::EUROPE_LONDON}, datetime::timezones::ATLANTIC_JAN_MAYEN), {"timestamp": 0, "tz": datetime::timezones::ATLANTIC_JAN_MAYEN})
}),
test::test({
"name": "parse",
"name": "parse RFC3339",
"test": test::assert("datetime::parse", datetime::parse("2022-11-09T14:46:11.499274824+01:00", datetime::formats::RFC3339), 1668001571499274824)
}),
test::test({
"name": "parse RFC3339 Z",
"test": test::assert("datetime::parse", datetime::parse("2023-04-23T13:11:37.285Z", datetime::formats::RFC3339), 1682255497285000000)
}),
test::test({
"name": "parse RFC2822",
"test": test::assert("datetime::parse", datetime::parse("Fri, 21 Nov 1997 09:55:06 -0600", datetime::formats::RFC2822), 880127706000000000)
}),
test::test({
"name": "format RFC2822",
"test": test::assert("datetime::format", datetime::format(880127706000000000, datetime::formats::RFC2822), "Fri, 21 Nov 1997 15:55:06 +0000")
}),
test::test({
"name": "format RFC2822 with timezone",
"test": test::assert("datetime::format", datetime::format(datetime::with_timezone(880127706000000000, datetime::timezones::US_CENTRAL), datetime::formats::RFC2822), "Fri, 21 Nov 1997 09:55:06 -0600")
}),
test::test({
"name": "year",
"test": test::assert("datetime::year", datetime::year(0), 1970)
Expand Down
2 changes: 1 addition & 1 deletion tremor-script/lib/std/datetime/formats.tremor
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
## Format for [RFC 3339](https://www.rfc-editor.org/rfc/rfc3339#section-5.6)
##
## This format is also ISO8601 compatible.
const RFC3339 = "%Y-%m-%dT%H:%M:%S%.f%:z";
const RFC3339 = "%+";

## Format for [RFC 2822](https://www.rfc-editor.org/rfc/rfc2822#section-3.3)
##
Expand Down

0 comments on commit 04c0d6d

Please sign in to comment.