[rt-users] TicketSQL Date parse weird..

Ruslan Zakirov ruz at bestpractical.com
Fri Jun 15 12:51:40 EDT 2012


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.com.au> wrote:
>> -----Original Message-----
>> From: ruslan.zakirov at gmail.com [mailto:ruslan.zakirov at gmail.com]
>> 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-apps 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-apps 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.



More information about the rt-users mailing list