assume all datetimes are UTC time and add timezone designator to

generated iso8601 strings
This commit is contained in:
alisdair sullivan 2015-03-03 10:43:04 -08:00
parent 2824e56d44
commit 84f4b7fb40
3 changed files with 6 additions and 4 deletions

View file

@ -112,7 +112,7 @@ value([{raw, Raw}|Tokens], Handler, Stack, Config) when is_binary(Raw) ->
value([{{Year, Month, Day}, {Hour, Min, Sec}}|Tokens], Handler, Stack, Config)
when is_integer(Year), is_integer(Month), is_integer(Day), is_integer(Hour), is_integer(Min), is_integer(Sec) ->
value([{string, unicode:characters_to_binary(io_lib:format(
"~4.10.0B-~2.10.0B-~2.10.0BT~2.10.0B:~2.10.0B:~2.10.0B",
"~4.10.0B-~2.10.0B-~2.10.0BT~2.10.0B:~2.10.0B:~2.10.0BZ",
[Year, Month, Day, Hour, Min, Sec]
))}|Tokens],
Handler,
@ -1145,7 +1145,7 @@ fix_key_test_() ->
datetime_test_() ->
[
{"datetime", ?_assertEqual(
[start_array, {string, <<"2014-08-13T23:12:34">>}, end_array, end_json],
[start_array, {string, <<"2014-08-13T23:12:34Z">>}, end_array, end_json],
parse([start_array, {{2014,08,13},{23,12,34}}, end_array, end_json], [])
)}
].