From c4eab0007a788703bc63db82fd995ef646820529 Mon Sep 17 00:00:00 2001 From: Michael Budde Date: Sun, 31 Mar 2019 13:18:09 +0200 Subject: Add support for '%F' date format specifier '%F' is equivalent to '%Y-%m-%d'. Using the '%F' format without this change this would not give any hard errors but instead give dates with wrong years because the 'has_year' trait would not be correctly detected and thus parsed dates would get set to the current year. Fixes #1775 --- src/times.cc | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'src/times.cc') diff --git a/src/times.cc b/src/times.cc index b9c67078..640e5019 100644 --- a/src/times.cc +++ b/src/times.cc @@ -55,18 +55,18 @@ namespace { temporal_io_t(const char * _fmt_str, bool _input) : fmt_str(_fmt_str), - traits(icontains(fmt_str, "%y"), - icontains(fmt_str, "%m") || icontains(fmt_str, "%b"), - icontains(fmt_str, "%d")), + traits(icontains(fmt_str, "%F") || icontains(fmt_str, "%y"), + icontains(fmt_str, "%F") || icontains(fmt_str, "%m") || icontains(fmt_str, "%b"), + icontains(fmt_str, "%F") || icontains(fmt_str, "%d")), input(_input) { } void set_format(const char * fmt) { fmt_str = fmt; - traits = date_traits_t(icontains(fmt_str, "%y"), - icontains(fmt_str, "%m") || - icontains(fmt_str, "%b"), - icontains(fmt_str, "%d")); + traits = date_traits_t(icontains(fmt_str, "%F") || icontains(fmt_str, "%y"), + icontains(fmt_str, "%F") || + icontains(fmt_str, "%m") || icontains(fmt_str, "%b"), + icontains(fmt_str, "%F") || icontains(fmt_str, "%d")); } T parse(const char *) {} -- cgit v1.2.3