[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: New year wildcard for string->date

"Dave Gurnell" wrote:
> I use  string->date to parse dates in  my user interfaces,
> and my users  are always entering the year  with the wrong
> number of digits.

> (string->date "13/01/2010" "~d/~m/~y") ; => 13/01/2020 - incorrect
> (string->date "13/01/10"   "~d/~m/~Y") ; => 13/01/0010 - incorrect

If  I am  not mistaken,  this  specific cases  can be  fixed

(string->date "13/01/2010 " "~d/~m/~y ")
(string->date "13/01/10 " "~d/~m/~Y ")

that is: appending a white  space to both the strings, which
force the  termination of the escape sequence  match.  It is
not much beautiful but it is ready now.

  The  only  clean alternative  I  see  is  to introduce  an
end-of-string escape sequence, analogous to "$" for regexps.
Marco Maggi