Giter VIP home page Giter VIP logo

Comments (5)

jmettraux avatar jmettraux commented on June 7, 2024

Hello,

thanks for the report. I am working on it.

As a workaround, you could use "every tuesday at 00:00" as seen in

fugit/spec/cron_spec.rb

Lines 265 to 288 in 49b6670

it 'correctly increments into DST (gh-53 c)' do
in_zone 'Europe/Zurich' do
#c = Fugit::Nat.parse('every monday at midnight')
#c = Fugit::Cron.parse('0 0 * * 2')
c = Fugit::Nat.parse('every tuesday at 00:00')
t = EtOrbi::EoTime.parse('2021-03-14 12:00:00')
points =
4.times.collect do
t = c.next_time(t)
tu = t.dup.utc
"#{t.strftime('%F_%H:%M_%Z')}__#{tu.strftime('%F_%H:%M_%Z')}"
end
expect(points.join("\n")).to eq(%w[
2021-03-16_00:00_CET__2021-03-15_23:00_UTC
2021-03-23_00:00_CET__2021-03-22_23:00_UTC
2021-03-30_00:00_CEST__2021-03-29_22:00_UTC
2021-04-06_00:00_CEST__2021-04-05_22:00_UTC
].join("\n"))
end
end

I think I am guilty of interpreting "every monday at midnight" as "every monday at 00:00". I need to straighten that.

Now, I still have to double-check, the entrance into DST is done at 02:00, it should make a 00:00 schedule skip.

transition

from fugit.

jmettraux avatar jmettraux commented on June 7, 2024

@andyundso

Hello, could you please tell me if the above fix suits you? If yes, I will release 1.4.3.

require 'fugit'

ENV['TZ'] = 'Europe/Zurich'

t0 = Time.parse('2021-03-22 13:00')

p Fugit.parse('every monday at midnight').next_time(t0).to_s
  # ==>     "2021-03-29 00:00:00 +0200"
  # and not "2021-04-05 00:00:00 +0200"

Best regards.

from fugit.

andyundso avatar andyundso commented on June 7, 2024

Good morning @jmettraux

Many thanks for the quick reaction. I tested the master branch with our test and now it works. I think you can release 1.4.3.

Best regards, Andy

from fugit.

jmettraux avatar jmettraux commented on June 7, 2024

It's released https://rubygems.org/gems/fugit/versions/1.4.3

Thanks again!

from fugit.

jmettraux avatar jmettraux commented on June 7, 2024

@andyundso

Hello,

for the sake of completeness, I added a spec for when leaving the DST (October) and it failed. I have fixed the problem and released 1.4.4. 550e571

Please upgrade before October.

Best regards.

from fugit.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.