
ruz at bestpractical
Jun 15, 2012, 9:51 AM
Post #8 of 8
(441 views)
Permalink
|
Hi, I took another look at this. ParseDate can not deal with all timezones zoneinfo database has. The module just knows about a few zones and time differences for them, so we will have to keep our magic. Wrote a few tests and couldn't find any problem with how we parse "tomorrow 10am". You can see new tests in 4.2/relative-time-parsing-tests branch. I don't see any changes between 3.8 and master that can affect outcome, so I conclude that your test is wrong or you're misreading Unix time values. If you still think that I'm missing something then please change your script to use ->ISO or any other date formatter instead of comparing Unix values. On Wed, Jun 13, 2012 at 3:20 AM, Stuart Browne <stuart.browne [at] ausregistry> wrote: >> -----Original Message----- >> From: ruslan.zakirov [at] gmail [mailto:ruslan.zakirov [at] gmail] >> Sent: Wednesday, 13 June 2012 12:31 AM >> Subject: Re: [rt-users] TicketSQL Date parse weird.. >> >> Hello Stuart, >> >> I've made a typo in the patch. It should be "ZONE" instead of "GMT". >> You can change code by hands after patching, it's close to line 208 in >> lib/RT/Date.pm. >> >> Also, make sure ParseDate module is the latest from the CPAN. >> > > <snip> > > Ensured I'm running the latest ParseDate - 2011.0517. Â Yes, I was running an older version. Â The output didn't appear different before changing GMT to ZONE (for before-10am). > > After changing GMT to ZONE, this happened: > > # > # BEFORE 10AM > # > > # > # Before patch > # > [bekar [at] psg-app tmp]$ ./test.pl > current time() output: Â Â Â Â Â 1339542313 > > fixed-date Time::ParseDate: Â Â 1339632000 > tomorrow 10am Time::ParseDate: Â 1339632000 > > fixed-date RT::Date output: Â Â 1339668000 > tomorrow 10am RT::Date output: Â 1339632000 > timezone according to RT::Date: 36000 > timezone according to RT::Date: 36000 > > # > # After patch > # > [bekar [at] psg-app tmp]$ ./test.pl > current time() output: Â Â Â Â Â 1339542211 > > fixed-date Time::ParseDate: Â Â 1339632000 > tomorrow 10am Time::ParseDate: Â 1339632000 > > fixed-date RT::Date output: Â Â 1339668000 > tomorrow 10am RT::Date output: Â 0 > timezone according to RT::Date: 36000 > timezone according to RT::Date: 36000 > > So it doesn't like ZONE there it seems: > > - Â Â Â Â Â Â GMT Â Â Â Â Â => $self->Timezone($args{'Timezone'}), > + Â Â Â Â Â Â ZONE Â Â Â Â Â => $self->Timezone($args{'Timezone'}), > > I'll try again after 14:00 (with GMT and the new ParseDate), although why RT::Date is returning 0 there is just odd. > > Stuart -- Best regards, Ruslan.
|