Prevent ambigious splitting of [0-9]{4}-[0-9]{2}
This commit is contained in:
		| @@ -609,6 +609,12 @@ final class NodaTimeSplitter { | |||||||
|  |  | ||||||
|             // Assume the end is a month |             // Assume the end is a month | ||||||
|             if (intval($month) < 12) { |             if (intval($month) < 12) { | ||||||
|  |                 // If the year is smaller than the second number, do not split, as either month | ||||||
|  |                 // or year may be meant | ||||||
|  |                 // Example: 1903-04 | ||||||
|  |                 if (substr($datum, 2, 2) < 12) { | ||||||
|  |                     return false; | ||||||
|  |                 } | ||||||
|                 return new NodaSplitTime($year, $year, $month); |                 return new NodaSplitTime($year, $year, $month); | ||||||
|             } |             } | ||||||
|             else { |             else { | ||||||
|   | |||||||
| @@ -604,6 +604,7 @@ final class NodaTimeSplitterTest extends TestCase { | |||||||
|             "13.13.2022", |             "13.13.2022", | ||||||
|             "2022-13-13", |             "2022-13-13", | ||||||
|             "40.10.2022", |             "40.10.2022", | ||||||
|  |             "1903-04", | ||||||
|             "1903/04", |             "1903/04", | ||||||
|             "2022-10-40", |             "2022-10-40", | ||||||
|             "6;November 1978", |             "6;November 1978", | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user