Code Monkey home page Code Monkey logo

Comments (2)

rlanvin avatar rlanvin commented on August 28, 2024

Hello, interesting case. You are right that this is a timezone issue.

You are setting DTSTART with an explicit time in UTC (Z) timezone, but check_date with no time, so it picks up the time configured in your PHP instance, which I'm going to guess isn't UTC.

So if you set the time also to UTC, this should work:

'check_date' => '2023-05-01 00:00:00Z'

Alternatively, if you remove the time from DTSTART, this should also work:

$task = [
    'rrule' => 'DTSTART:20220803
RRULE:FREQ=MONTHLY;INTERVAL=3;BYDAY=1MO',
    'check_date' => '2023-05-01'
];

A 3rd option, if you set PHP timezone to UTC, this should also work:

date_default_timezone_set('UTC');
$task = [
    'rrule' => 'DTSTART:20220803T000000Z
RRULE:FREQ=MONTHLY;INTERVAL=3;BYDAY=1MO',
    'check_date' => '2023-05-01'
];

I'll admit it's a bit confusing, but essentially you have to make sure the time component of DTSTART matches exactly with the time component of the occurrence you want to check - or don't use time component at all.

from php-rrule.

b4tch avatar b4tch commented on August 28, 2024

Hey, thanks so much for the quick reply, it makes perfect sense that's why it's failing. Simply appending the Z to the time worked.

from php-rrule.

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.