From 25a592de8423c0e40e85af4a49015829e3470a89 Mon Sep 17 00:00:00 2001 From: vt Date: Sat, 8 Aug 2015 18:15:02 +0300 Subject: [PATCH 1/3] accept datetime with msec --- src/jsx_parser.erl | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/src/jsx_parser.erl b/src/jsx_parser.erl index 322494c..7e6c6cf 100644 --- a/src/jsx_parser.erl +++ b/src/jsx_parser.erl @@ -119,6 +119,16 @@ when is_integer(Year), is_integer(Month), is_integer(Day), is_integer(Hour), is_ Stack, Config ); +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_float(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:~9.6.0fZ", + [Year, Month, Day, Hour, Min, Sec] + ))}|Tokens], + Handler, + Stack, + Config + ); value([{_, Value}|Tokens], Handler, Stack, Config) -> value([Value] ++ Tokens, Handler, Stack, Config); value([String|Tokens], Handler, Stack, Config) when is_atom(String) -> @@ -1147,6 +1157,10 @@ datetime_test_() -> {"datetime", ?_assertEqual( [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], []) + )}, + {"datetime", ?_assertEqual( + [start_array, {string, <<"2014-08-13T23:12:34.363369Z">>}, end_array, end_json], + parse([start_array, {{2014,08,13},{23,12,34.363369}}, end_array, end_json], []) )} ]. From 91b3c47e1b71498e29f5fad08d85759374d32a8c Mon Sep 17 00:00:00 2001 From: alisdair sullivan Date: Sat, 8 Aug 2015 17:46:51 -0700 Subject: [PATCH 2/3] add tvv's contributions to CHANGES and README --- CHANGES.md | 4 ++++ README.md | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/CHANGES.md b/CHANGES.md index c6b6a05..880dcda 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -1,3 +1,7 @@ +vNext + +* support for milliseconds in datetimes + v2.7.0 * `return_tail` option diff --git a/README.md b/README.md index 3e4abe8..59300a6 100644 --- a/README.md +++ b/README.md @@ -715,7 +715,7 @@ following events must be handled: ## acknowledgements ## -jsx wouldn't be what it is without the contributions of [Paul J. Davis](https://github.com/davisp), [Lloyd Hilaiel](https://github.com/lloyd), [John Engelhart](https://github.com/johnezang), [Bob Ippolito](https://github.com/etrepum), [Brujo Benavides](https://github.com/elbrujohalcon), [Alex Kropivny](https://github.com/amtal), [Steve Strong](https://github.com/srstrong), [Michael Truog](https://github.com/okeuday), [Devin Torres](https://github.com/devinus), [fogfish](https://github.com/fogfish), [emptytea](https://github.com/emptytea), [John Daily](https://github.com/macintux), [Ola Bäckström](https://github.com/olabackstrom), [Joseph Crowe](https://github.com/JosephCrowe), [Patrick Gombert](https://github.com/patrickgombert), [Eshengazin S. Kuat](https://github.com/eskuat), [Max Lapshin](https://github.com/maxlapshin), [Bikram Chatterjee](https://github.com/c-bik), [Michael Uvarov](https://github.com/arcusfelis) and [Led](https://github.com/Ledest) +jsx wouldn't be what it is without the contributions of [Paul J. Davis](https://github.com/davisp), [Lloyd Hilaiel](https://github.com/lloyd), [John Engelhart](https://github.com/johnezang), [Bob Ippolito](https://github.com/etrepum), [Brujo Benavides](https://github.com/elbrujohalcon), [Alex Kropivny](https://github.com/amtal), [Steve Strong](https://github.com/srstrong), [Michael Truog](https://github.com/okeuday), [Devin Torres](https://github.com/devinus), [fogfish](https://github.com/fogfish), [emptytea](https://github.com/emptytea), [John Daily](https://github.com/macintux), [Ola Bäckström](https://github.com/olabackstrom), [Joseph Crowe](https://github.com/JosephCrowe), [Patrick Gombert](https://github.com/patrickgombert), [Eshengazin S. Kuat](https://github.com/eskuat), [Max Lapshin](https://github.com/maxlapshin), [Bikram Chatterjee](https://github.com/c-bik), [Michael Uvarov](https://github.com/arcusfelis), [Led](https://github.com/Ledest) and [tvv](https://github.com/tvv) [json]: http://json.org [yajl]: http://lloyd.github.com/yajl From 99c81f88b9526f2fcbd87040f1341d12cc97fbff Mon Sep 17 00:00:00 2001 From: alisdair sullivan Date: Thu, 20 Aug 2015 09:22:23 -0700 Subject: [PATCH 3/3] v2.7.1 --- CHANGES.md | 2 +- README.md | 2 +- mix.exs | 3 ++- src/jsx.app.src | 2 +- 4 files changed, 5 insertions(+), 4 deletions(-) diff --git a/CHANGES.md b/CHANGES.md index 880dcda..9430e79 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -1,4 +1,4 @@ -vNext +v2.7.1 * support for milliseconds in datetimes diff --git a/README.md b/README.md index 59300a6..fd17c05 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# jsx (v2.7.0) # +# jsx (v2.7.1) # an erlang application for consuming, producing and manipulating [json][json]. diff --git a/mix.exs b/mix.exs index 7d4eaca..7443cbd 100644 --- a/mix.exs +++ b/mix.exs @@ -4,7 +4,7 @@ use Mix.Project def project do [ app: :jsx, - version: "2.7.0", + version: "2.7.1", description: "an erlang application for consuming, producing and manipulating json. inspired by yajl", deps: deps(Mix.env), package: package, @@ -25,6 +25,7 @@ use Mix.Project "LICENSE", "mix.exs", "rebar.config", + "rebar.config.script", "README.md", "src" ], diff --git a/src/jsx.app.src b/src/jsx.app.src index 553a3d1..0cd0237 100644 --- a/src/jsx.app.src +++ b/src/jsx.app.src @@ -1,7 +1,7 @@ {application, jsx, [ {description, "a streaming, evented json parsing toolkit"}, - {vsn, "2.7.0"}, + {vsn, "2.7.1"}, {modules, [ jsx, jsx_encoder,