alpinweis / cronex

Ruby library that converts cron expressions into human readable strings
Other
78 stars 29 forks source link

Timezone conversion doesn't change the days #13

Open paul-mesnilgrente opened 4 years ago

paul-mesnilgrente commented 4 years ago

The day of month / day of the week are not updated when changing the timezone. For example:

Cronex::ExpressionDescriptor.new('0 22 * * 1-5', {}, 'en', 'UTC').description
# => "At 10:00 PM, Monday through Friday"
Cronex::ExpressionDescriptor.new('0 22 * * 1-5', {}, 'en', 'Pacific/Auckland').description
# => "At 11:00 AM, Monday through Friday"

We can see that it's still Monday through Friday in Pacific/Auckland when it should be Tuesday through Saturday because NZDT is 13 hours ahead (see: https://savvytime.com/converter/utc-to-nzst/mar-2-2020/10pm).

Can you think of a good way to support this? I had a look at the code but it looks pretty complicated.