mirror of
https://github.com/valitydev/yamerl.git
synced 2024-11-06 02:45:23 +00:00
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".
This commit is contained in:
parent
fb56071724
commit
24a56f503f
@ -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.
|
||||
|
Loading…
Reference in New Issue
Block a user