My problem seems similar to this closed issue #1014664: Repeat Until Issue but it doesn't look like that was committed and I'm not sure it's correct for my situation.

I'm using a date field with repeating configured to use "No timezone handling". The Site timezone is set to New York and users set their own timezone. I discovered the problem mostly on events with DAILY repeats because the last day would display as the next day, ie. it repeats daily ending on OCT 27 but when the date is output in views and field output in the node then it shows as going until OCT 28. Also, for excluded dates I set OCT 24 but the output for the repeating rule read, "excluding OCT 23". The output on these is only wrong for users with their timezone, ie. Los Angeles, set to something different than the Site timezone. When I check the database I see the following rrule based on those dates:

RRULE:FREQ=DAILY;INTERVAL=1;UNTIL=20171028T045959Z;WKST=SU
EXDATE:20171024T050000Z

I think those times should not be adjusted for timezone. The UNTIL time should be set to 23:59:59 of the final date and EXDATE time should be 00:00:00 of the date. Also, with the field configured with Timezone handing set to "No timezone handling" (a.k.a. 'none' in the date API) then the timezone is defaulting to "date_default_timezone()" which returns the Site's setting for the timezone instead of the field's setting of 'none' which should set everything to 'UTC'.

The fix in the attached patch touches both, date_api and date_repeat. I have not tested this with other date field configurations. Does timezone need to be applied to these until/exclude/add dates for other use cases?

This patch only fixes the problem for data entered from now but does not correct any old data. It looks like there is a bit of a mess in the old data because those old dates will need to be rolled back the proper number of hours (daylight savings is applied to some).

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

trrroy created an issue. See original summary.

trrroy’s picture

Issue summary: View changes
DamienMcKenna’s picture

Version: 7.x-2.10 » 7.x-2.x-dev
DamienMcKenna’s picture

A slight adjustment to the 'switch' syntax.

Any thoughts on the simplest way of testing this? Given there are changes to date_api it might be possible to test date_get_timezone_db() directly.

DamienMcKenna’s picture

DamienMcKenna’s picture

I completely agree this is set up wrong, so let's fix it for the next release. However, I don't know if setting it to UTC is the correct option either.

DamienMcKenna’s picture

DamienMcKenna’s picture

Assigned: Unassigned » DamienMcKenna
Status: Needs review » Needs work

Working on test coverage.

DamienMcKenna’s picture

I split off some initial test coverage on the Date Repeat system to #3276311.

DamienMcKenna’s picture

Can you please clarify if the field is configured to use the All Day feature? In my initial testing I don't see the problem you described.

DamienMcKenna’s picture

Assigned: DamienMcKenna » Unassigned