Support from Acquia helps fund testing for Drupal Acquia logo

Comments

white_pawn’s picture

A big +1 from me.

SchwebDesign’s picture

This worked for us! THANK YOU! What a life saver this was in certain contexts.

This also solves this issue in the queue: http://drupal.org/node/1401688

Christopher Riley’s picture

Thank you ever so much as this works beautifully. Can we please get this officially committed soon please?

Christopher Riley’s picture

Possibly I spoke too soon and or I am forgetting something. When I go into a repeating event it shows only the one date as intended however the date that it shows is for the next event not for that specific events date.

For example I have a repeating event the third Friday of each month. So my dates should be:

Friday, February 15, 2013
Friday, March 16, 2012
Friday, April 20, 2012

And so on. What I want to do is to show a event list with a view but instead of showing the next coming up event show the rrule date that is associated with that entry if that makes sense.

Is there any way to do that?

Thanks in advance

podarok’s picture

Issue summary: View changes
Status: Needs review » Needs work
Issue tags: +Needs tests

all feature requests should be covered by tests

podarok’s picture

Status: Needs work » Needs review
toelli’s picture

Iv been using this patch and we're having some wierd problems with timezone.

(line 502 date.module)

         $range[0] = new DateObject($from, date_default_timezone());
         $range[1] = new DateObject($to, date_default_timezone());

When you create the relative notation dates they get created in local time... and this is kinda bad if your local timezone is not UTC because below in the loop where we remove the multiple values it gets compared to the default UTC database timestamps...

I tried to change to "new DateObject($from, 'UTC');" but DateObject does not even seem to work with adding a timezone?

My solution:

      $range[0] = new DateObject($from);
      $range[0]->setTimezone(new DateTimeZone('UTC'));
      $range[1] = new DateObject($to);
      $range[1]->setTimezone(new DateTimeZone('UTC'));
vijaycs85’s picture

Issue tags: +sprint
bkosborne’s picture

And what about caching? Once you use relative dates, like dates that include the current date, it will only work if caching is disabled for that node view or if the page cache entry is cleared very often.

jwilson3’s picture

cache-busting is always hard to get right, but #9 sounds like a configuration issue. You must set your cache lifetime to something at or lower than your desired relative date granularity accuracy.

hwasem’s picture

Thanks, SchwebDesign, for the reference over here. This is EXACTLY what I was looking for. I applied the patch in OP and selected the relative date format. Now "today" and "now-12 hours" are working. Exactly what I needed to fix an issue I erroneously posted in Display Suite #2257435: Use a relative "Starting from" value in repeating date fields.

I sure hope this gets approved for Date as the partial implementation is confusing.

misthero’s picture

good one, hope it gets in the module works here

joshuautley’s picture

Patched worked for us - RBTC

joshuautley’s picture

Status: Needs review » Reviewed & tested by the community
devad’s picture

#0 patch re-roll against 7.x-2.9

Update: Something went wrong with this re-rolling, so I'm hiding this patch from files list.

joshuautley’s picture

Has anyone tested #15?

We noticed that the recent update of the Date module to version 7.x-2.9 did in fact bring this issue back up for us.

I've applied the patch #15 but I do not see any difference in functionality.

Our goal is to simply display the most relative date. So, in the content type display settings we have it limited to display only 1 date, which we were thinking would not be a past date but instead the the first date in the future or the current date but no more than one date. In other words we don't want to see all future dates.

I ticked the box for "Show repeat rule" which gives us a sentence like, "Repeats every week every Wednesday until Wed Jan 27 2016".

Where is the radio button in UI as described below...?

"User interface changes
The current patch introduces new radio elements in the field output formatter in the case it has a cardinality > 1."

Steve Polito Design’s picture

I applied this patch which allowed me to use relative dates as demonstrated here.

MoCart’s picture

So why does #15 have no final line ending (which generates an error) and in the middle of this statement:

$form['show_remaining_days'] = array(

Even more oddly, it works on my local mac osx but not on a hosted linux server, tho all the files updated exactly the same.

pslcbs’s picture

Patch #0 works perfectly for me on Date 7.x-2.9 as @Steve-Polito-Design explains on the link example

Patch on #15 gives me this error:

patch unexpectedly ends in middle of line
patch: **** Only garbage was found in the patch input.

Thank you all!!

devad’s picture

Something went wrong with #15 re-roll, so I'm hidding #15 patch from files list.

joshuautley’s picture

Thank you for working on it devad.

I'll re-apply and see how it goes.

podarok’s picture

Status: Reviewed & tested by the community » Needs work
el35’s picture

Issue summary: View changes

I'm testing my issue. If all will be ok, I publish it

MatthijsG’s picture

So, after days of struggling with this i found this thread. I used the original patch (see #17) and followed the blog from @steve-polito-design http://www.stevepolitodesign.com/blog/correctly-display-repeating-dates-... Thanks Steve!

In my case i use only a block with Views. The block shows the next date from now (and some extra info). Didn't config the display in Content Type; the date is hidden in the default display.
See for my config the screenshot - the only thing i set up. It's in dutch, but you get the point.

el35’s picture

After patching I still had problem with range date "to". It shows all dates, example: I set date "from -> now" and "to -> today 23:59", but node displays all dates from now to end od event. I found (with friend of mine), that in line 561 is set value2, which relevant nowhere, but I'm not sure. I prepared ptach (including above patch) with my resolve.

Anonymous’s picture

I rerolled the patch because the previous patches no longer apply. Apply this patch to 7.x-2.x-dev.

szt’s picture

Status: Needs work » Needs review

The last submitted patch, 26: date.module.diff, failed testing. View results

rwilson0429’s picture

Thank you @pferlito. The re-rolled patch applied cleanly to the 7.x-2.x-dev.

Anonymous’s picture

Status: Needs review » Reviewed & tested by the community

Thank you rwilson0429.

sashken2’s picture

Patch #27 working. Thanks!

DamienMcKenna’s picture

Rerolled.

DamienMcKenna’s picture

Status: Reviewed & tested by the community » Needs work

Putting this back to "needs work" as it needs some tests.

sean_e_dietrich’s picture

FileSize
5.75 KB

I didn't work on the tests but for the time being, rerolled the patch to work with the latest version of 7.x-2.x and should work on 7.x-2.14