From: Brad Hilton Date: 2004-02-26T04:14:16+09:00 Subject: Re: date/format.rb fix NAKAMURA, Hiroshi wrote: >>The _parse() function of date/format.rb does not handle fractions of >>seconds. Eg, the string >> >>2004-02-12 12:23:45.581297-07 >> >>causes the parser to miss the timezone offset. > >>A simple change to the regex can fix this: > > >>- /(\d+):(\d+)(?::(\d+))? >>+ /(\d+):(\d+)(?::(\d+)(?:\.\d+)?)? > > > Drop fractions? > > /(\d+):(\d+)(?::(\d+(?:\.\d+)?))? > > Could be better but I don't know how we treat $3 string. > $3 is converted to Integer via to_i now. Float? Rational? I wasn't sure - that's why I updated the regex to simply drop the fraction. :) Dropping the fraction is not ideal, but at least people won't have any unpleasant surprises if they are expecting the current behavior (converting the seconds to an int). > The author Funaba-san merely seen in this ML. I'll forward it > some later date. Thank you. -Brad