Closed assembler closed 5 years ago
Sorry, what version of Ruby on what Operating System are you using?
On my ruby 2.3.7p456 (2018-03-28 revision 63024) [x86_64-darwin17]
Time.new(2019, 1, 1, 0, 0, 0, TZInfo::Timezone.get('UTC'))
# ==> TypeError: can't convert TZInfo::DataTimezone into an exact number
its ruby 2.6.3p62 (2019-04-16 revision 67580) [x86_64-darwin18]
OK, I'll look into this (from the Ruby < 2.6 point of view for now)
require 'fugit'
cron = Fugit::Cron.parse("0 0 * * * PST8PDT")
p cron
# => #<Fugit::Cron:0x00007fb3b8bdf880
# @original="0 0 * * * PST8PDT", @cron_s=nil, @seconds=[0],
# @minutes=[0], @hours=[0], @monthdays=nil, @months=nil, @weekdays=nil,
# @zone="PST8PDT", @timezone=#<TZInfo::DataTimezone: PST8PDT>>
#p cron.match?(Time.utc(2019, 1, 1, 0, 0, 0))
p cron.match?(EtOrbi.parse('2019-1-1'))
# => true
#p cron.match?(Time.new(2019, 1, 1, 0, 0, 0, TZInfo::Timezone.get('UTC')))
p cron.match?(EtOrbi.parse('2019-1-1 UTC'))
# => true
#p cron.match?(Time.new(2019, 1, 1, 0, 0, 0, TZInfo::Timezone.get('CET')))
p cron.match?(EtOrbi.parse('2019-1-1 ETC'))
# => true
#p cron.match?(Time.new(2019, 1, 1, 0, 0, 0, TZInfo::Timezone.get('PST8PDT')))
p cron.match?(EtOrbi.parse('2019-1-1 PST8PDT'))
# => true
Closing, moved to https://github.com/floraison/fugit/issues/31
Thanks!
Timezone seems to be completely irrelevant when calling
match?
on cron object:I thought setting timezone in cron would make it only match in specific time zone. In example above i'd expect it to match only in PST8PDT midnight.