Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Passing DateTime as startDay including microseconds will set first recurrence to the next day instead of current #155

Open
deadpony opened this issue Dec 24, 2018 · 0 comments

Comments

@deadpony
Copy link

deadpony commented Dec 24, 2018

$transformer = new \Recurr\Transformer\ArrayTransformer();

$transformerConfig = new \Recurr\Transformer\ArrayTransformerConfig();
$transformerConfig->enableLastDayOfMonthFix();
$transformer->setConfig($transformerConfig);

$rule = new \Recurr\Rule("FREQ=DAILY;COUNT=1;WKST=MO");

$startDate = new \DateTime();

$startDate->setTime($startDate->format('H'), $startDate->format('i'), $startDate->format('s'), 5);

$rule->setStartDate($startDate, true);

print_r($transformer->transform($rule));

// 2018-12-25

$startDate->setTime($startDate->format('H'), $startDate->format('i'), $startDate->format('s'), 0);

$rule->setStartDate($startDate, true);

print_r($transformer->transform($rule));

// 2018-12-24

So, if the startDate contains any microseconds transform will be incorrect

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant