From 24a56f503fa160c03b981ec7822395a4ce3a1091 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jean-S=C3=A9bastien=20P=C3=A9dron?= Date: Thu, 26 May 2011 15:40:49 +0200 Subject: [PATCH] Time undefined for a date-only timestamp If the timestamp as the form "DD:MM::YYYY", the time is set to "undefined" instead of "00:00:00". --- src/yaml_node_timestamp.erl | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/yaml_node_timestamp.erl b/src/yaml_node_timestamp.erl index 70d3951..5cd6878 100644 --- a/src/yaml_node_timestamp.erl +++ b/src/yaml_node_timestamp.erl @@ -48,6 +48,8 @@ represent_token(#yaml_repr{simple_structs = true}, case string_to_timestamp(Text) of {undefined, undefined, undefined, H, Mi, S, _, _} -> {finished, {undefined, {H, Mi, S}}}; + {Y, Mo, D, undefined, undefined, undefined, _, _} -> + {finished, {{Y, Mo, D}, undefined}}; {Y, Mo, D, H, Mi, S, _, _} -> {finished, {{Y, Mo, D}, {H, Mi, S}}}; error -> @@ -105,7 +107,8 @@ string_to_timestamp(Text) -> list_to_integer(Y), list_to_integer(Mo), list_to_integer(D), - 0, 0, 0, 0, 0 + undefined, undefined, undefined, + 0, 0 }; {match, [_, _, _, _, _, _, _, _, _, H, Mi, S]} -> %% Only a time.