I'm not a php expert (by a long way) but I've been trying to hack together a solution for the DST problem.

The following code does not work, but I'm hoping that some drupal/php guru may be able to point out where I'm going wrong:

Inserted into node_repeat.module:

if (isset($date_diff)) {
  $end_date = date_make_date($dt, $date_tzdb);
  date_modify($end_date, '+' . $date_diff . " seconds");
  $field[0]['value2'] = date_format($end_date, $date_format);
}

becomes:

if (isset($date_diff)) {
  $end_date = date_make_date($dt, $date_tzdb);
  date_modify($end_date, '+' . $date_diff . " seconds");

        if ( date_format(date_make_date($start_date, $date_tzdb), 'I') && !(date_format($end_date, 'I')) ) {
          date_modify($end_date, '+1 hour');
        }
        elseif ( !(date_format(date_make_date($start_date, $date_tzdb), 'I')) && date_format($end_date, 'I') ) {
          date_modify($end_date, '-1 hour');
        }


  $field[0]['value2'] = date_format($end_date, $date_format);
}

I thought that this would compare the dates of the original and repeat nodes, and that if one was in DST and the other wasn't that it would +/- 1 hour as necessary.
But it doesn't
I suspect that I am not understanding drupal's date management (or maybe even php's).

I hope that some expert can help sort this out.

Comments

MasterChief’s picture

There's a bug when a sequence extends over a day light savings boundary: it adds/subtracts time from the advertised time for those events that are after the current DST period. The time as stored in the database remains constant, but after DST adjustments is of course different). I'm not quite sure how to handle this, but I guess it needs to compensate for it by adjusting the time stored in the database. Let me know if you know the solution; it's probably something obvious that's already been dealt with or that I'm handling the wrong way *sheepish grin*.

I think it's the first problem you may fix gargarine because it's a real problem.

abursni maybe the guys who work on the Date module could help, but just for information, i have 2 hours between the real date and the second date time make by Node Repeat.

gagarine’s picture

Assigned: Unassigned » gagarine

Thanks for the report.

Please witch version of PHP do you use?

MasterChief do you have the same problem?

gagarine’s picture

Priority: Normal » Critical
MasterChief’s picture

I have php 5.2.11

Yes i have the same problem, olivercoleman spotted the problem, here his comment on the module page :

There's a bug when a sequence extends over a day light savings boundary: it adds/subtracts time from the advertised time for those events that are after the current DST period. The time as stored in the database remains constant, but after DST adjustments is of course different). I'm not quite sure how to handle this, but I guess it needs to compensate for it by adjusting the time stored in the database. Let me know if you know the solution; it's probably something obvious that's already been dealt with or that I'm handling the wrong way *sheepish grin*.

I don't know how he managed date.

But it's a real problem.

gagarine’s picture

Thank to confirm.

The support request on date project #993630: date_repeat_calc not adjusting time for DST in repeat sequence

gagarine’s picture

I played with this module today and study http://drupal.org/project/date_repeat_nodegen.

The creation of node is more elegant with nodegen. I asked the maintainer for a fusion. This will be more a refactoring but will close this issue as a side effect.

The interface will change by using the standard date repeat widget directly in the node creation. Tell me if this UI change can be a problem...

MasterChief’s picture

I don't think it's a problem.

Did the maintainer of the other module answers you ?

gagarine’s picture

No answers :(.
Perhaps it is a bug in date #1008244: Dates sotred in database add/substract daylight saving time (DST) instead of using UTC or at least in documentation.
I will create a quick fix for the 6.x-1 branch and directly start a new branch 6.x-2 with the new UI. This depends of the answers I get.

MasterChief’s picture

I saw that the other module didn't have any update since the first day of creation which was the 4th april 2009, i think it's better to doesn't wait anything :)

gagarine’s picture

Version: 6.x-1.1 » 6.x-1.x-dev
Status: Active » Needs review

This commit http://drupal.org/cvs?commit=470214 should correct the problem. I still don't get why DST need to be stored in database but at least it works.

You can try the 6.x-1.x-dev (after it's rebuild). Or just patch http://drupalcode.org/viewvc/drupal/contributions/modules/node_repeat/no...

I will release a soon as peoples test it and confirm here than nothing is broken.

cwgriesel’s picture

Status: Needs review » Needs work

Node Repeat 6.x-1.x-dev fixes the DST problem, but now the advanced repeat features don't work. Choosing "Second Friday" creates a node for *every* friday in the range, not just second fridays.

gagarine’s picture

Thanks a lot for your review. I think I know what is the problem... I will take a look asap.

MasterChief’s picture

I confirm that the dst problem isn't a problem anymore :)

gagarine’s picture

Version: 6.x-1.x-dev » 6.x-2.x-dev

I just started a new branch where I'm going to solve that and other issues. This branch has a different approach and use the insert form.

This branch is not ready for testing...

MasterChief’s picture

Ok gargarine, so i will wait to test the new branch !

atolborg’s picture

I am a bit confused. Which version should I install (test), and which module is 'stable' ?

MasterChief’s picture

Hi atolborg!

You must use 6.x-1.x-dev to have a stable version.

6.x-2.x-dev is for new features but even for only test, you shouldn't install it for now.

I hope it will help you :)

gagarine’s picture

Status: Needs work » Needs review

I made a 6.x-2.0-alpha1 release. It's a complete rewrite . I didn't test it deeply and they are still some stuff to do but I hop it works with DST and advanced repeat feature.

Please try it but read the release note for know issues. Don't hesitate to report every other issue and suggestion (but please open new one).

atolborg’s picture

Thanks alot gagarine. I will test it right away.
Please keep perfecting the module, since it has great potential.

Thanks.

MacaroniDuck’s picture

This is huge gagarine and will benefit a LOT of people. A couple of us have even been lobbying to get this included in the release of Drupal Commons. It's a great installation package, but useless to a lot of social networking groups without the ability to properly create repeating events.

Once you're a touch farther along in testing, I'll be able to jump in and do some testing myself.

MacaroniDuck’s picture

I noticed after this was released that several posts appeared making it seem that that alpha came with a new host of issues. Because of that, I've continued using the old version with the DST issue, waiting to hear word on the new issues. Since then, I've not seen much activity for this mod. Is there an update? Is the DST issue truly fixed? Are the other issues being addressed?
I may have some time in the not too distant future to do some testing of this myself, but would love to hear an update first.

cwgriesel’s picture

My experience is that DST issue is fixed in 6.x-2.0-alpha1, but now node repeats aren't creating separate, individual nodes for each instance of the repeat sequence. Node repeats work if I keep all dates in one node, but choosing to create a new node for each date doesn't work.

Anyone else notice the same behavior?

MacaroniDuck’s picture

That alpha works fine for me creating individual nodes but has several other issues that make it unusable.

MasterChief’s picture

I hope gagarine will come soon, we can't use the module with the errors actually.

gagarine’s picture

Version: 6.x-2.x-dev » 6.x-3.x-dev
Status: Needs review » Postponed (maintainer needs more info)

If someone can try DST with the 6.x-3.x it will be great. Please try on a test website with a clean installation.

keith.aumiller’s picture

I checked this on a fairly new website, (not completely clean) and still saw the issue.

lightsurge’s picture

I just tested this and it seems to work fine... so long as I'm testing this right.

My timezone is set as GMT (which changes to BST for summertime) created a year's worth of node repeat nodes, and they all showed a consistent time.

keith.aumiller’s picture

I'll update and let you know.