Coder Social home page Coder Social logo

Comments (3)

zensh avatar zensh commented on August 27, 2024

It works well on my computer:

package main

import (
	"fmt"
	"time"

	"github.com/teambition/rrule-go"
)

func main() {
	rule, _ := rrule.NewRRule(rrule.ROption{
		Freq:    rrule.HOURLY,
		Dtstart: time.Date(2023, time.March, 26, 1, 30, 0, 0, time.Local),
		Until:   time.Date(2023, time.March, 26, 5, 0, 0, 0, time.Local),
	})
	recurrences := rule.All()
	fmt.Println(recurrences)
	// [2023-03-26 01:30:00 +0800 CST 2023-03-26 02:30:00 +0800 CST 2023-03-26 03:30:00 +0800 CST 2023-03-26 04:30:00 +0800 CST]
}

from rrule-go.

yhabteab avatar yhabteab commented on August 27, 2024

It works well on my computer:

From the outputs you provided, there is no DST changes on your computer. Otherwise, the 02:30 event wouldn't have appeared there. For comparison on my end (Mac Ventura), here's what it looks like. I just used the exact same program.

[
   2023-03-26 01:30:00 +0100 CET // Before 2 am, so no DST change
   2023-03-26 03:30:00 +0200 CEST // This is supposed to be 02:30, but there is no such time due to the daylight saving time change at 02:00.
   2023-03-26 03:30:00 +0200 CEST // The same event as the previous one
  2023-03-26 04:30:00 +0200 CEST
]

from rrule-go.

zensh avatar zensh commented on August 27, 2024

Some underlying code used UTC, Maybe you should do:

	rule, _ := rrule.NewRRule(rrule.ROption{
		Freq:    rrule.HOURLY,
		Dtstart: time.Date(2023, time.March, 26, 1, 30, 0, 0, time.UTC),
		Until:   time.Date(2023, time.March, 26, 5, 0, 0, 0, time.UTC),
	})

And then convert the results to CEST time

from rrule-go.

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.