// assertDateFormatV1 assert the format dd/mm/yyyy of a date string
// and returns an error if fails.
assertDateFormatV1 assert the format dd/mm/yyyy of a date string
and returns an error if fails.
// assertDateFormatV1 assert the format dd / mm / yyyy of a date string // and returns an error if fails .
func assertDateFormatV1(val, caller string) error {
	dateFormat := "dd/mm/yyyy"
	if len(val) != 10 {
		return &DateError{caller, dateFormat}
	}
	day, err := strconv.Atoi(val[0:2])
	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[3:5])
	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[6:10])
	if err != nil {
		return &DateError{caller, dateFormat}
	}
	return nil
}
func assertDateFormatV1 ( val , caller string ) error { dateFormat := " " if len ( val ) != 10 { return & DateError { caller , dateFormat } } day , err := strconv . Atoi ( val [ 0 : 2 ] ) if err != nil { return & DateError { caller , dateFormat } } if day < 1 || 31 < day { return fmt . Errorf ( " " , caller ) } month , err := strconv . Atoi ( val [ 3 : 5 ] ) if err != nil { return & DateError { caller , dateFormat } } if month < 1 || 12 < month { return fmt . Errorf ( " " , caller ) } _ , err = strconv . Atoi ( val [ 6 : 10 ] ) if err != nil { return & DateError { caller , dateFormat } } return nil }
assertDateFormatV1 assert the format dd/mm/yyyy of a date string
and returns an error if fails.
assertDateFormatV1 assert the format dd / mm / yyyy of a date string and returns an error if fails .