concourse / time-resource

a resource for triggering on an interval
Apache License 2.0
44 stars 32 forks source link

Specifying time zone in start/stop as well as location should be disabled #26

Open jleben opened 6 years ago

jleben commented 6 years ago

There are problems when one specifies start and stop with a time zone (e.g. 15:00 -0700) but also provides a location.

Specifically, it is neither well specified nor obvious what the behavior should be when the location is inconsistent with the time zone.

Even when the location is consistent with the time zone (e.g. America/Vancouver during PDT, which is -0700), the interpretation of start and stop is wrong. This is because func (*TimeOfDay) UnmarshalJSON for some reason converts start and stop to UTC before extracting hour and minute. This can easily be verified by running check with the following input at 00:30 -0700, which produces no new version:

{
  "source": {
    "start": "00:00 -0700",
    "stop": "01:00 -0700",
    "location": "America/Vancouver"
  }
}

Due to all of the above, I think check should simply abort with error in such case.