fill the first two digits for year based on the current year when importing a two-digit year

This commit is contained in:
MaysWind
2025-06-19 22:36:40 +08:00
parent 787eaad352
commit 5dc0e925c1
6 changed files with 68 additions and 21 deletions
+15
View File
@@ -236,6 +236,11 @@ func TestIsValidYearMonthDayLongOrShortDateFormat_ValidFormat(t *testing.T) {
actualValue := IsValidYearMonthDayLongOrShortDateFormat(datetime)
assert.Equal(t, expectedValue, actualValue)
datetime = "24-09-01"
expectedValue = true
actualValue = IsValidYearMonthDayLongOrShortDateFormat(datetime)
assert.Equal(t, expectedValue, actualValue)
datetime = "2024-09-1"
expectedValue = true
actualValue = IsValidYearMonthDayLongOrShortDateFormat(datetime)
@@ -278,6 +283,11 @@ func TestIsValidMonthDayYearLongOrShortDateFormat_ValidFormat(t *testing.T) {
actualValue := IsValidMonthDayYearLongOrShortDateFormat(datetime)
assert.Equal(t, expectedValue, actualValue)
datetime = "09-01-24"
expectedValue = true
actualValue = IsValidMonthDayYearLongOrShortDateFormat(datetime)
assert.Equal(t, expectedValue, actualValue)
datetime = "09-1-2024"
expectedValue = true
actualValue = IsValidMonthDayYearLongOrShortDateFormat(datetime)
@@ -320,6 +330,11 @@ func TestIsValidDayMonthYearLongDateFormat_ValidLongDateFormat(t *testing.T) {
actualValue := IsValidDayMonthYearLongOrShortDateFormat(datetime)
assert.Equal(t, expectedValue, actualValue)
datetime = "01-09-24"
expectedValue = true
actualValue = IsValidDayMonthYearLongOrShortDateFormat(datetime)
assert.Equal(t, expectedValue, actualValue)
datetime = "1-09-2024"
expectedValue = true
actualValue = IsValidDayMonthYearLongOrShortDateFormat(datetime)