mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-27 12:11:13 +00:00
datetime: ignore 0 days or months in dates
Handle 0 months or days correctly in date strings, so that 2012-06-00 is parsed the same as 2012-06, for example.
This commit is contained in:
parent
7b80441f9d
commit
f738dbe86a
1 changed files with 14 additions and 0 deletions
|
@ -711,6 +711,20 @@ gst_date_time_new_from_iso8601_string (const gchar * string)
|
|||
|
||||
if (ret == 0)
|
||||
return NULL;
|
||||
|
||||
if (ret == 3 && day <= 0) {
|
||||
ret = 2;
|
||||
day = -1;
|
||||
}
|
||||
|
||||
if (ret >= 2 && month <= 0) {
|
||||
ret = 1;
|
||||
month = day = -1;
|
||||
}
|
||||
|
||||
if (ret >= 1 && year <= 0)
|
||||
return NULL;
|
||||
|
||||
else if (ret >= 1 && len < 16)
|
||||
/* YMD is 10 chars. XMD + HM will be 16 chars. if it is less,
|
||||
* it make no sense to continue. We will stay with YMD. */
|
||||
|
|
Loading…
Reference in a new issue