def _isValidDate(date_string):
 from datetime import date
 (year, month, day) = map(int, date_string.split('-'))
 if (year < 1900):
  raise ValidationError, gettext('Year must be 1900 or later.')
 try:
  date(year, month, day)
 except ValueError as e:
  msg = (gettext('Invalid date: %s') % gettext(str(e)))
  raise ValidationError, msg

def _isValidDate ( date_string ) : from datetime import date ( year , month , day ) = map ( int , date_string . split ( '-' ) ) if ( year < 1900 ) : raise ValidationError , gettext ( 'Year must be 1900 or later.' ) try : date ( year , month , day ) except ValueError as e : msg = ( gettext ( 'Invalid date: %s' ) % gettext ( str ( e ) ) ) raise ValidationError , msg
a helper function used by isvalidansidate and isvalidansidatetime to check if the date is valid .