Mailing List Archive: 49091 messages
  • Home
  • Script library
  • AltME Archive
  • Mailing list
  • Articles Index
  • Site search
 

[REBOL] Question about date? function

From: bkalef:sympatico:ca at: 13-Oct-2001 1:00

Should the date? function return false if an invalid date is entered? For example, when entering (YYYY-MM-DD);
>> date? 2001-12-25
== true So you would think that a False would be returned if a date was incorrect, however, unexpectedly;
>> date? 2001-13-25
** Syntax Error: Invalid date -- 2001-13-25 ** Near: (line 1) date? 2001-13-25 Since date? doesn't return a false but a Syntax Error. When I try the following I would expect it to gracefully allow me to enter an invalid date and allow me to write code around it to correct it.
>> if error? try [ date? 2001-13-25] [print "An invalid date was entered"]
** Syntax Error: Invalid date -- 2001-13-25 ** Near: (line 1) error? try [ date? 2001-13-25] Any thoughts?