Properly exclude 00 for partial dates, fixes #477
This commit is contained in:
@@ -66,6 +66,9 @@ namespace lms::core
|
||||
"%Y-%m-%dT%H:%M:%S",
|
||||
"%Y-%m-%d %H:%M:%S",
|
||||
"%Y/%m/%d %H:%M:%S",
|
||||
"%Y-%m",
|
||||
"%Y/%m",
|
||||
"%Y",
|
||||
};
|
||||
|
||||
for (const char* format : formats)
|
||||
|
||||
@@ -87,23 +87,34 @@ namespace lms::core::stringUtils::tests
|
||||
};
|
||||
|
||||
constexpr TestCase tests[]{
|
||||
{ "", "" },
|
||||
{ "aaaa", "" },
|
||||
{ "aaaa-bb", "" },
|
||||
{ "1992", "1992" },
|
||||
{ "1992-03", "1992-03" },
|
||||
{ "1992-00", "1992" },
|
||||
{ "1992-03-00", "1992-03" },
|
||||
{ "1992-03-27", "1992-03-27" },
|
||||
{ "1992-00-00", "1992" },
|
||||
{ "1992-03-27T15", "1992-03-27T15" },
|
||||
{ "1992-03-27T15:08", "1992-03-27T15:08" },
|
||||
{ "1992-03-27T15:08:57", "1992-03-27T15:08:57" },
|
||||
{ "1992-03-00T15:08:57", "1992-03" },
|
||||
|
||||
{ "1992-03-27 15", "1992-03-27T15" },
|
||||
{ "1992-03-27 15:08", "1992-03-27T15:08" },
|
||||
{ "1992-03-27 15:08:57", "1992-03-27T15:08:57" },
|
||||
|
||||
{ "aaaa/bb", "" },
|
||||
{ "1992", "1992" },
|
||||
{ "1992/00", "1992" },
|
||||
{ "1992/03", "1992-03" },
|
||||
{ "1992/03/00", "1992-03" },
|
||||
{ "1992/03/27", "1992-03-27" },
|
||||
{ "1992/03/27 15", "1992-03-27T15" },
|
||||
{ "1992/03/27 15:08", "1992-03-27T15:08" },
|
||||
{ "1992/03/27 15:08:57", "1992-03-27T15:08:57" },
|
||||
{ "1992/03/00 15:08:57", "1992-03" },
|
||||
};
|
||||
|
||||
for (const TestCase& test : tests)
|
||||
|
||||
Reference in New Issue
Block a user