Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Facts:
- Content type was originally created from Features
- All date fields on this content type (and no others) exhibit this behavior
Short description:
- Create a node of this type with a date entered (say 3/6/15 - 6:00pm).
- Field is set to use Site's timezone (America/New_York (Eastern)), to use Now as default value
- New node shows now in that field as it should in the proper timezone
- Save the new node, the time is inserted into the DB with the value as seen (6:00pm) but as UTC
- When you edit the node, it loads the time of 6:00pm UTC and converts as it should to Eastern, so you get 1:00pm
- Save the node, it stores 1:00pm again and displays as 8:00am.
- This cycle continues to where you lose 5 hours every time you save the node and don't adjust the time forward by 5 extra hours!!
Happy to provide any and all other relevant information. Hopefully I've described it clearly enough. Thanks!
Comments
Comment #1
scotwith1tComment #2
scotwith1tComment #3
vijaycs85Thanks @scotself for the detailed issue summary.
I have tried exact scenario in issue summary and can't reproduce the issue. Here is the list of steps I have followed:
1. Created a field of type 'Date' with default now and timezone as 'site default'
2. Created new node and didn't touch the date field and saved. Displayed as 2015-03-06 09:15 and saved in DB as '2015-03-06 17:15:00', because my timezone was (-08:00)
3. Edit node and saw same '2015-03-06 09:15' and saved same as '2015-03-06 17:15:00'.
4. Exported the content type as a feature module
5. Enabled the feature module and status says 'default' in feature list page.
6. Removed the fields from content type
7. Reverted feature from UI.
8. Make sure the field is back in content type.
9. Repeated step 1 to 3 and got same result.
I'm using drupal(7.x), date (7.x-2.x) and features (7.x-2.4).
Comment #4
wrd CreditAttribution: wrd commentedI'm having the same problem, I believe. In my case, the field is not collecting hour, minute, or second -- only year, month, and day. I do not have an option to specify a time zone for the field. I was using 7.x-2.8, but tried upgrading to the dev release (as of today); still no such option.
Saving February 24, 2015 (with pop-up calendar or select menu) results in a stored value of 2015-02-24 00:00:00. Pulling the value with an entity metadata wrapper gets me epoch time of 1424736000. In my time zone (UTC-6), this is displaying as February 23, 2015.
EDIT: My problem may not be the same. If I enable hours/minutes collection, the timezone conversion option displays. I can set it to site's time zone, and the date is then displayed correctly.
I'll open a new issue for the problem with the form element.
Comment #5
Anonymous (not verified) CreditAttribution: Anonymous as a volunteer commentedThis BUG IS REAL!
When it collects only Y-m-d, we cannot specify timezone!!!
Thing is, when changing field as
$node->field[0][value] = timestamp
correct date is set
BUT
if we use correct way with entity wrapper
$w_node->field = timestamp
site's timezone is applied to our date.
---
core: 7.41
Date : 7x-2.9
Entity: 7x-1.6