Skip to content

Timezone mishandling can lead to errors #1637

@jcpitre

Description

@jcpitre

Describe the bug

It seems that the timezone used by the validator code is the one where the validator is running.
This is wrong since the validator could be running anywhere in the world, in a time zone different from the agency time zone. This is particularly true for the web validator that is running somewhere on the cloud.
The problem is that the now at two locations can be on different days. This potentially breaks validators like FeedExpirationDateValidator that give FeedExpirationDate7DaysNotice and FeedExpirationDate30DaysNotice

As an example it could be the 9th of January in Bangkok, and the 8th in Montreal. Let's say the agency time zone is the one for Bangkok (ICT I think). And let's say the feed end date is the 16th of January. We would expect to have the FeedExpirationDate7DaysNotice since 9 + 7 = 16. But since the Montreal time zone is used by the validator, it will not issue the notice until the next day (8 + 7 = 15)

We should change the validator to use the agency time zone, not the local time zone where the validator is running.

It's kind of a corner case where the error would not be very consequential (missing the notice by one day). But it should still be corrected. Plus there might be other notices affected.

Steps/Code to Reproduce

See the example above.
Ideally we should have a test case for that. To be written.

Expected Results

See the example above

Actual Results

See example above

Screenshots

No response

Files used

No response

Validator version

4.20

Operating system

irrelevant

Java version

No response

Additional notes

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working (crash, a rule has a problem)status: Needs discussionWe need a discussion on requirements before calling this issue ready

    Type

    No type

    Projects

    Status

    Requires investigation

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions