-
Notifications
You must be signed in to change notification settings - Fork 63
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix Views field custom date field output for year only #439
fix Views field custom date field output for year only #439
Conversation
Difference between this and contributed PR for 3.x branch is to always use date_default_timezone_get() and not the system-wide timezone configuration value |
*/ | ||
public function convertToUtc(FieldDefinitionInterface $definition, $date_value) { | ||
$datetime_format = $definition->getSetting('datetime_type') === DateTimeItem::DATETIME_TYPE_DATE ? DateTimeItemInterface::DATE_STORAGE_FORMAT : DateTimeItemInterface::DATETIME_STORAGE_FORMAT; | ||
$default_timezone = date_default_timezone_get(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This line is the difference from PR #435 for the 3.x branch
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If using the global configuration then if the per-user timezone setting is allowed, and if the user chooses a different timezone, then could have a discrepancy. Drupal manages this and gives the "right" timezone returned by date_default_timezone_get();
We've applied this PR on production and can confirm this is working for year-only custom fields. |
* origin/4.0.x: 4.0.x field mappings (eileenmcnaughton#430) Adding a raw value function to return value from values array (eileenmcnaughton#465) Add filter for state province. (eileenmcnaughton#453) Update default timezone handling for dates in CiviEntityStorage.php (eileenmcnaughton#461) fix testLoadContact birthdate assertion (eileenmcnaughton#472) port to 4.0.x from 436: Include dblocale table names in list of civicrm entity info (eileenmcnaughton#438) Ignore convert to UTC if custom field is date only (eileenmcnaughton#469) update contact entity referece field on contact merge (eileenmcnaughton#456) update test versions of Drupal 10.2 and CiviCRM 5.69 (eileenmcnaughton#468) Clean value on custom field for Float (Number) and Money field type (eileenmcnaughton#463) From eileenmcnaughton#378 for 4.0.x (eileenmcnaughton#466) Add reset to the file URLs generated. (eileenmcnaughton#458) fix Views field custom date field output for year only (eileenmcnaughton#439)
* origin/4.0.x: (41 commits) patch from issue 3420771 (eileenmcnaughton#475) only check for data in enabled components on module uninstall (eileenmcnaughton#476) Adds is Empty/NULL operators (eileenmcnaughton#423) Pathauto (eileenmcnaughton#470) fix test to use string instead of integer for zip code (eileenmcnaughton#474) 4.0.x field mappings (eileenmcnaughton#430) Adding a raw value function to return value from values array (eileenmcnaughton#465) Add filter for state province. (eileenmcnaughton#453) Update default timezone handling for dates in CiviEntityStorage.php (eileenmcnaughton#461) fix testLoadContact birthdate assertion (eileenmcnaughton#472) port to 4.0.x from 436: Include dblocale table names in list of civicrm entity info (eileenmcnaughton#438) Ignore convert to UTC if custom field is date only (eileenmcnaughton#469) update contact entity referece field on contact merge (eileenmcnaughton#456) update test versions of Drupal 10.2 and CiviCRM 5.69 (eileenmcnaughton#468) Clean value on custom field for Float (Number) and Money field type (eileenmcnaughton#463) From eileenmcnaughton#378 for 4.0.x (eileenmcnaughton#466) Add reset to the file URLs generated. (eileenmcnaughton#458) fix Views field custom date field output for year only (eileenmcnaughton#439) update Add Contact to Group Views Bulk operations action plugin access handler (eileenmcnaughton#464) Readme update (eileenmcnaughton#457) ...
Port and tweak of contributed PR #435
Before
Year only custom date fields for some time zones displays wrong value.
After
Custom fields with year only format always show correctly.