// assertDateFormatV2 assert the format yyyy-mm-dd of a date string
// and returns an error if fails.
assertDateFormatV2 assert the format yyyy-mm-dd of a date string
and returns an error if fails.
// assertDateFormatV2 assert the format yyyy - mm - dd of a date string // and returns an error if fails .
func assertDateFormatV2(val, caller string) error {
	dateFormat := "yyyy-mm-dd"
	if len(val) != 10 {
		return &DateError{caller, dateFormat}
	}
	day, err := strconv.Atoi(val[8:10])
	if err != nil {
		return &DateError{caller, dateFormat}
	}
	if day < 1 || 31 < day {
		return fmt.Errorf("%s format error: invalid day value", caller)
	}
	month, err := strconv.Atoi(val[5:7])
	if err != nil {
		return &DateError{caller, dateFormat}
	}
	if month < 1 || 12 < month {
		return fmt.Errorf("%s format error: invalid month value", caller)
	}
	_, err = strconv.Atoi(val[0:4])
	if err != nil {
		return &DateError{caller, dateFormat}
	}
	return nil
}
func assertDateFormatV2 ( val , caller string ) error { dateFormat := " " if len ( val ) != 10 { return & DateError { caller , dateFormat } } day , err := strconv . Atoi ( val [ 8 : 10 ] ) if err != nil { return & DateError { caller , dateFormat } } if day < 1 || 31 < day { return fmt . Errorf ( " " , caller ) } month , err := strconv . Atoi ( val [ 5 : 7 ] ) if err != nil { return & DateError { caller , dateFormat } } if month < 1 || 12 < month { return fmt . Errorf ( " " , caller ) } _ , err = strconv . Atoi ( val [ 0 : 4 ] ) if err != nil { return & DateError { caller , dateFormat } } return nil }
assertDateFormatV2 assert the format yyyy-mm-dd of a date string
and returns an error if fails.
assertDateFormatV2 assert the format yyyy - mm - dd of a date string and returns an error if fails .