Currently, the timeslot field displays the correct timezone wherever it is used. However, the token which creates the automatic title for the Timeslot content type is not taking time zones into account, regardless of the site's time zone settings. I believe this is a quick fix to the tokens which generate the node title for the Timeslot content type.

Comments

ezra-g’s picture

Title: Automatic Node Titles for Time Slots Should Not Display in GMT » Automatic Node Titles for Time Slots Should Use site timezone, Not Display in GMT
Status: Active » Closed (works as designed)

Just updating the title to clarify the desired behavior (vs using user timezones). Thanks!

ezra-g’s picture

Status: Closed (works as designed) » Active
sheldonkreger’s picture

Category: task » feature
StatusFileSize
new122.34 KB
new26.75 KB

I did some additional testing. The issue is the same as described in OP. See image below. I had modified both the sitewide and user time settings . . . then I created the node.

field_slot_datetime is working correctly, but the node titles are displaying correctly. By default, it reflects the sitewide time zone settings.The display of field_slot_datetime also changes for users in different timezones. That's awesome! That's what we would like to have happen to the node titles, as well.

The problems lies in the token which is used to generate the title of the node. Although the pattern is set to [node:field_slot_datetime], it's converting it to GMT when it creates the node:

There may be a way to configure around this, or it could be a general problem with the way the node title is generated - which would be outside of the scope of COD. I'm curious if anybody knows a quick way to fix this.

sheldonkreger’s picture

Status: Active » Postponed

This appears to be an issue with Automatic Nodetitles and the way it handles tokens. This seems to be a closely related issue #1197278: Date tokens are not displaying correctly.

langworthy’s picture

closed #1837918: Timeslot title uses UTC not site timezone as a duplicate of this issue

langworthy’s picture

This seems to be because dates are stored in UTC and token.module is not doing any conversion #1103032: Document how to use date tokens

I tried using an entity_token.module pattern instead, like [node:field-slot-datetime:medium]. But the token literal becomes the title.

langworthy’s picture

I got this working using the following ANT pattern [node:field-slot-datetime:value:custom:l M j g:ia] - [node:field-slot-datetime:value2:custom:l M j g:ia] and a D7 version of the patch here http://drupal.org/node/1035292#comment-6659022 to allow spaces in tokens.

ezra-g’s picture

Category: feature » bug
Priority: Normal » Critical
Status: Postponed » Needs work

Since "displaying wrong event time" is a fairly critical aspect of an event management tool, I'm marking as critical and "needs work" pending a patch for #7.

chrisguindon’s picture

StatusFileSize
new719 bytes

Attach is a patch that replace the title pattern to [node:field-slot-datetime:value:custom:l, M j, Y H:i] - [node:field-slot-datetime:value2:custom:l, M j, Y H:i].

This is based off comment #7 but I made some changes. This is an example of how the title date will appear:
Thursday, May 30, 2013 00:00 - Thursday, May 30, 2013 20:00

ezra-g’s picture

Status: Needs work » Needs review

Awesome - Thanks, chrisguindon!

Marking as "needs review".

greggles’s picture

I didn't test the patch, but I put the pattern in place and conceptually I agree that pattern is better.

rootwork’s picture

Status: Needs review » Reviewed & tested by the community
StatusFileSize
new27.29 KB

This is great, and would also fix the same issue where you add allowed slots to a room:

Screen Shot 2013-08-22 at 10.17.31 PM.png

It might be worth considering if this specific configuration should be documented, since some sites might want to change the display of the time (e.g. with 12-hour + AM/PM).

But this patch is HUGE improvement on the current situation.

japerry’s picture

Issue summary: View changes
Status: Reviewed & tested by the community » Closed (fixed)

Oh forgot to mark this as fixed.. from a while ago! Its now based upon the timezone set in the time entity itself.

jcicolani’s picture

Version: 7.x-1.x-dev » 7.x-1.0-beta9
Status: Closed (fixed) » Active
StatusFileSize
new16.04 KB

The patch seems to no longer apply to the cod_session.strongarm.inc file and the node titles are displaying 5 hours off of the selected times.

timwood’s picture

@jcicolani
The patch I provided here: https://www.drupal.org/node/2407607#comment-9999695
seems to do the trick for us. Not sure whether it's correct or not.

japerry’s picture

Issue tags: +cod 7.x-1.0 radar
CountPacMan’s picture

Version: 7.x-1.0-beta9 » 7.x-1.x-dev
Status: Active » Needs review
StatusFileSize
new1.01 KB

Previous patch removed offset which made it store the user's time zone time in the db. I broke out the logic of what is generated for the time stored in the db and what is generated for the label.

BabaYaga64’s picture

Status: Needs review » Reviewed & tested by the community

I was able to apply CountPacMan's patch and now I'm able to create time slots for events based on appropriate timezones, and now the time slots display based on the event timezones, and not the user or site timezones.

CountPacMan’s picture

Status: Reviewed & tested by the community » Needs review
StatusFileSize
new979 bytes

updated patch to remove extraneous code and wrap in t()

pcorbett’s picture

Just so that we're clear, the fix at https://www.drupal.org/node/2407607#comment-9999695 seems to work well (although it may make sense to wrap in t() as in @CountPacMan's patch #19). Is there a particular reason why we're not formatting the date any longer (e.g., 4:45pm vs. 2015-07-31 16:45:00)? I suggest that https://www.drupal.org/node/2407607 and this aren't any different really and one should fall in favor for the other.

japerry’s picture

Version: 7.x-1.x-dev » 7.x-2.x-dev
Status: Needs review » Fixed

This is fixed in the 2.x branch.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.