CommentFileSizeAuthor
#60 3185750-60.patch98.41 KBnatemow
#59 3185750-59.patch98.08 KBnatemow
#58 3185750-58.patch98.21 KBkasey_mk
#56 3185750-56.patch98.21 KBandrtroe
#55 drupal-core--date_range_timezone-3185750-55-8.3.x.patch97.57 KBveronicaseveryn
#54 3185850-54.patch96.08 KBkasey_mk
#52 interdiff_51-52.txt0 byteskasey_mk
#52 3185850-52.patch96.53 KBkasey_mk
#51 3185750-51.patch97.23 KBborutpiletic
#50 3185750-50.patch97.13 KBborutpiletic
#48 3185750-48.patch97.23 KBbalagan
#47 3185750-47.patch97.28 KBbalagan
#43 3185750-43.patch76.45 KBbalagan
#42 3185750-42.patch97.98 KBnatemow
#34 3185750-34.patch98.1 KB_utsavsharma
#34 interdiff_32-34.txt928 bytes_utsavsharma
#32 3185750-32.patch98.1 KBkasey_mk
#30 3185750-30.patch98.32 KBkasey_mk
#28 interdiff_18-28.txt7.42 KBkasey_mk
#28 3185750-28.patch98.2 KBkasey_mk
#27 interdiff_18-27.txt9.05 KBkasey_mk
#27 3185750-27.patch98.2 KBkasey_mk
#22 interdiff_18-22.txt1.07 KBravi.shankar
#22 3185750-22.patch98.2 KBravi.shankar
#18 interdiff-3185750-16-18.txt6.29 KByogeshmpawar
#18 3185750-18.patch98.2 KByogeshmpawar
#16 reroll_diff_3185750-timezone-field-9.3.0-12_3185750-16.txt6.94 KByogeshmpawar
#16 3185750-16.patch98.14 KByogeshmpawar
#12 3185750-timezone-field-9.3.0-12.patch98.68 KBbaysaa
#11 3185750-timezone-field-D9.3.0-11.patch125.22 KBbaysaa
#7 interdiff_5-7.txt4.26 KBranjith_kumar_k_u
#7 3185750-7.patch98.39 KBranjith_kumar_k_u
#5 3185750-9.2.x-4.patch98.43 KBisaacrc
#3 3185750-9.1.x-3.patch98.56 KBdouggreen
#2 3185750-9.1.x-2.patch101.48 KBjaperry

Issue fork drupal-3185750

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

dww created an issue. See original summary.

japerry’s picture

Status: Active » Needs work
StatusFileSize
new101.48 KB

Rerolled for Drupal 9.1.0.. However, tests need to be updated to remove deprecated calls.

douggreen’s picture

StatusFileSize
new98.56 KB

Attempted preroll, previous patch didn't apply.

Version: 9.2.x-dev » 9.3.x-dev

Drupal 9.2.0-alpha1 will be released the week of May 3, 2021, which means new developments and disruptive changes should now be targeted for the 9.3.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

isaacrc’s picture

StatusFileSize
new98.43 KB

I was getting this error with patch in #3:

The website encountered an unexpected error. Please try again later.
TypeError: Argument 7 passed to Drupal\datetime_range\Plugin\Field\FieldWidget\DateRangeDefaultWidget::__construct() must be an instance of Drupal\datetime_range\Plugin\Field\FieldWidget\ConfigFactoryInterface or null, instance of Drupal\Core\Config\ConfigFactory given, called in /app/web/core/modules/datetime_range/src/Plugin/Field/FieldWidget/DateRangeDefaultWidget.php on line 56 in Drupal\datetime_range\Plugin\Field\FieldWidget\DateRangeDefaultWidget->__construct() (line 35 of core/modules/datetime_range/src/Plugin/Field/FieldWidget/DateRangeDefaultWidget.php).

I took a look and only the import of the ConfigFactory class was missing:
use Drupal\Core\Config\ConfigFactoryInterface;
I attach the patch for 9.2.x with this small change. Thanks for the previous ones!

pakmanlh’s picture

Status: Needs work » Needs review
ranjith_kumar_k_u’s picture

StatusFileSize
new98.39 KB
new4.26 KB

Fixed CS errors

Gauravmahlawat made their first commit to this issue’s fork.

Version: 9.3.x-dev » 9.4.x-dev

Drupal 9.3.0-rc1 was released on November 26, 2021, which means new developments and disruptive changes should now be targeted for the 9.4.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

baysaa’s picture

StatusFileSize
new125.22 KB

Rerolled patch for 9.3.0

baysaa’s picture

StatusFileSize
new98.68 KB

Cleaned up the *.orig and *.rej files that got included in the patch.

daffie’s picture

Status: Needs review » Needs work

The patch needs to land in D9.4, not D9.3. It is too late to land in D9.3.

kasey_mk’s picture

Thank you Baysaa! Patch in #12 seems to be working for us on 9.3.2

rajab natshah’s picture

Tested 3185750-timezone-field-9.3.0-12.patch with Drupal 9.3.x
Thank you Baysaa

yogeshmpawar’s picture

Status: Needs work » Needs review
StatusFileSize
new98.14 KB
new6.94 KB

Resolved CSpell errors & reroll the patch against 9.4.x with a reroll-diff attached.

Status: Needs review » Needs work

The last submitted patch, 16: 3185750-16.patch, failed testing. View results

yogeshmpawar’s picture

Status: Needs work » Needs review
StatusFileSize
new98.2 KB
new6.29 KB

Updated patch will fix test failures.

Status: Needs review » Needs work

The last submitted patch, 18: 3185750-18.patch, failed testing. View results

Version: 9.4.x-dev » 9.5.x-dev

Drupal 9.4.0-alpha1 was released on May 6, 2022, which means new developments and disruptive changes should now be targeted for the 9.5.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

jksloan2974’s picture

Issue summary: View changes

Patch is broken on Drupal 9.4.2

ravi.shankar’s picture

Status: Needs work » Needs review
StatusFileSize
new98.2 KB
new1.07 KB

Fixing failed tests of patch #18.

Status: Needs review » Needs work

The last submitted patch, 22: 3185750-22.patch, failed testing. View results

socialnicheguru’s picture

I get this when I try to update:

The following updates are pending:

datetime module :
8001 - Add the 'timezone' field to all datetime field tables.

datetime_range module :
8001 - Add the 'timezone' field to all daterange field tables.

Do you wish to run all pending updates? (y/n): y
Cannot add field [error]
'user_revision__field_last_password_reset.field_last_password_reset_timezone': table
doesn't exist.
Performing datetime_update_8001 [ok]
Performing datetime_range_update_8001 [ok]
Failed: Cannot add field [error]
'user_revision__field_last_password_reset.field_last_password_reset_timezone': table
doesn't exist.

kasey_mk’s picture

Has this been fixed? I don't see any issues marked "Fixed" nor do I see anything about timezones in the 9.4.8 release notes, but when I updated to 9.4.8, patch #18 wouldn't apply... but it looks like my date fields still have timezones?

I git cloned 9.4.x and it looks like at least some of what the patch did is already there, but not all of it (or at least, not in the same way).

UPDATE: nevermind, when I deployed to a new environment my timezones went away. I must have skipped a step locally. I'll try to work on a new version of the patch to bring 'em back.

Version: 9.5.x-dev » 10.1.x-dev

Drupal 9.5.0-beta2 and Drupal 10.0.0-beta2 were released on September 29, 2022, which means new developments and disruptive changes should now be targeted for the 10.1.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

kasey_mk’s picture

StatusFileSize
new98.2 KB
new9.05 KB

Here's a version of Patch #18 (#22 wouldn't install for me) updated for 9.4.8.

kasey_mk’s picture

StatusFileSize
new98.2 KB
new7.42 KB

Oops; search-and-replace error on some pluses, fixed here. I never could get patch #22 to install, so here's patch #18 updated for Drupal 9.4.8.

awolfey’s picture

Working for me. Thank you.

kasey_mk’s picture

StatusFileSize
new98.32 KB

Re-roll for Drupal 9.5

daffie’s picture

@Kasey_MK: This issue needs to land first in D10.1. Also there are some style guide violations:

--- Commands Executed ---
core/scripts/dev/commit-code-check.sh --drupalci
Return Code: 1
--- Output ---
CSpell: passed

----------------------------------------------------------------------------------------------------
..............E................. 32 / 32 (100%)



FILE: ...etime_range/src/Plugin/Field/FieldWidget/DateRangeWidgetBase.php
----------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
----------------------------------------------------------------------
 89 | ERROR | [x] Whitespace found at end of line
    |       |     (Squiz.WhiteSpace.SuperfluousWhitespace.EndLine)
----------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
----------------------------------------------------------------------


FILE: ...ules/datetime_range/src/Plugin/Field/FieldType/DateRangeItem.php
----------------------------------------------------------------------
FOUND 5 ERRORS AFFECTING 5 LINES
----------------------------------------------------------------------
 58 | ERROR | [x] Line indented incorrectly; expected 4 spaces, found
    |       |     6
    |       |     (Drupal.WhiteSpace.ScopeIndent.IncorrectExact)
 59 | ERROR | [x] Object operator not indented correctly; expected 8
    |       |     spaces but found 6
    |       |     (Drupal.WhiteSpace.ObjectOperatorIndent.Indent)
 92 | ERROR | [x] Array indentation error, expected 6 spaces but
    |       |     found 8 (Drupal.Arrays.Array.ArrayIndentation)
 95 | ERROR | [x] Array indentation error, expected 6 spaces but
    |       |     found 8 (Drupal.Arrays.Array.ArrayIndentation)
 99 | ERROR | [x] Array closing indentation error, expected 4 spaces
    |       |     but found 6
    |       |     (Drupal.Arrays.Array.ArrayClosingIndentation)
----------------------------------------------------------------------
PHPCBF CAN FIX THE 5 MARKED SNIFF VIOLATIONS AUTOMATICALLY
----------------------------------------------------------------------


FILE: ...ange/src/Plugin/Field/FieldFormatter/DateRangePlainFormatter.php
----------------------------------------------------------------------
FOUND 2 ERRORS AFFECTING 1 LINE
----------------------------------------------------------------------
 53 | ERROR | [x] Expected one space after the comma, 0 found
    |       |     (Drupal.WhiteSpace.Comma.NoSpace)
 53 | ERROR | [x] Each index in a multi-line array must be on a new
    |       |     line
    |       |     (Squiz.Arrays.ArrayDeclaration.IndexNoNewline)
----------------------------------------------------------------------
PHPCBF CAN FIX THE 2 MARKED SNIFF VIOLATIONS AUTOMATICALLY
----------------------------------------------------------------------


FILE: ...html/core/modules/datetime/tests/src/Kernel/DateTimeItemTest.php
----------------------------------------------------------------------
FOUND 4 ERRORS AFFECTING 4 LINES
----------------------------------------------------------------------
 367 | ERROR | [x] Whitespace found at end of line
     |       |     (Squiz.WhiteSpace.SuperfluousWhitespace.EndLine)
 370 | ERROR | [x] Whitespace found at end of line
     |       |     (Squiz.WhiteSpace.SuperfluousWhitespace.EndLine)
 373 | ERROR | [x] Whitespace found at end of line
     |       |     (Squiz.WhiteSpace.SuperfluousWhitespace.EndLine)
 376 | ERROR | [x] Whitespace found at end of line
     |       |     (Squiz.WhiteSpace.SuperfluousWhitespace.EndLine)
----------------------------------------------------------------------
PHPCBF CAN FIX THE 4 MARKED SNIFF VIOLATIONS AUTOMATICALLY
----------------------------------------------------------------------


FILE: ...core/modules/datetime/tests/src/Functional/DateTimeFieldTest.php
----------------------------------------------------------------------
FOUND 26 ERRORS AFFECTING 26 LINES
----------------------------------------------------------------------
 440 | ERROR | [x] Whitespace found at end of line
     |       |     (Squiz.WhiteSpace.SuperfluousWhitespace.EndLine)
 448 | ERROR | [x] Whitespace found at end of line
     |       |     (Squiz.WhiteSpace.SuperfluousWhitespace.EndLine)
 459 | ERROR | [x] Line indented incorrectly; expected 2 spaces,
     |       |     found 3
     |       |     (Drupal.WhiteSpace.ScopeIndent.IncorrectExact)
 460 | ERROR | [x] Expected 4 space(s) before asterisk; 3 found
     |       |     (Drupal.Commenting.DocCommentAlignment.SpaceBeforeStar)
 461 | ERROR | [x] Expected 4 space(s) before asterisk; 3 found
     |       |     (Drupal.Commenting.DocCommentAlignment.SpaceBeforeStar)
 475 | ERROR | [x] Whitespace found at end of line
     |       |     (Squiz.WhiteSpace.SuperfluousWhitespace.EndLine)
 482 | ERROR | [x] Whitespace found at end of line
     |       |     (Squiz.WhiteSpace.SuperfluousWhitespace.EndLine)
 496 | ERROR | [x] Whitespace found at end of line
     |       |     (Squiz.WhiteSpace.SuperfluousWhitespace.EndLine)
 511 | ERROR | [x] Whitespace found at end of line
     |       |     (Squiz.WhiteSpace.SuperfluousWhitespace.EndLine)
 520 | ERROR | [x] Whitespace found at end of line
     |       |     (Squiz.WhiteSpace.SuperfluousWhitespace.EndLine)
 526 | ERROR | [x] Whitespace found at end of line
     |       |     (Squiz.WhiteSpace.SuperfluousWhitespace.EndLine)
 544 | ERROR | [x] Whitespace found at end of line
     |       |     (Squiz.WhiteSpace.SuperfluousWhitespace.EndLine)
 553 | ERROR | [x] Whitespace found at end of line
     |       |     (Squiz.WhiteSpace.SuperfluousWhitespace.EndLine)
 571 | ERROR | [x] Whitespace found at end of line
     |       |     (Squiz.WhiteSpace.SuperfluousWhitespace.EndLine)
 587 | ERROR | [x] Whitespace found at end of line
     |       |     (Squiz.WhiteSpace.SuperfluousWhitespace.EndLine)
 590 | ERROR | [x] Whitespace found at end of line
     |       |     (Squiz.WhiteSpace.SuperfluousWhitespace.EndLine)
 597 | ERROR | [x] Whitespace found at end of line
     |       |     (Squiz.WhiteSpace.SuperfluousWhitespace.EndLine)
 606 | ERROR | [x] Whitespace found at end of line
     |       |     (Squiz.WhiteSpace.SuperfluousWhitespace.EndLine)
 626 | ERROR | [x] Whitespace found at end of line
     |       |     (Squiz.WhiteSpace.SuperfluousWhitespace.EndLine)
 648 | ERROR | [x] Whitespace found at end of line
     |       |     (Squiz.WhiteSpace.SuperfluousWhitespace.EndLine)
 658 | ERROR | [x] Whitespace found at end of line
     |       |     (Squiz.WhiteSpace.SuperfluousWhitespace.EndLine)
 671 | ERROR | [x] Whitespace found at end of line
     |       |     (Squiz.WhiteSpace.SuperfluousWhitespace.EndLine)
 687 | ERROR | [x] Whitespace found at end of line
     |       |     (Squiz.WhiteSpace.SuperfluousWhitespace.EndLine)
 694 | ERROR | [x] Whitespace found at end of line
     |       |     (Squiz.WhiteSpace.SuperfluousWhitespace.EndLine)
 713 | ERROR | [x] Whitespace found at end of line
     |       |     (Squiz.WhiteSpace.SuperfluousWhitespace.EndLine)
 720 | ERROR | [x] Whitespace found at end of line
     |       |     (Squiz.WhiteSpace.SuperfluousWhitespace.EndLine)
----------------------------------------------------------------------
PHPCBF CAN FIX THE 26 MARKED SNIFF VIOLATIONS AUTOMATICALLY
----------------------------------------------------------------------


FILE: ...les/datetime/src/Plugin/Field/FieldWidget/DateTimeWidgetBase.php
----------------------------------------------------------------------
FOUND 25 ERRORS AFFECTING 25 LINES
----------------------------------------------------------------------
 24 | ERROR | [x] Line indented incorrectly; expected 2 spaces, found
    |       |     3
    |       |     (Drupal.WhiteSpace.ScopeIndent.IncorrectExact)
 26 | ERROR | [x] Line indented incorrectly; expected 2 spaces, found
    |       |     3
    |       |     (Drupal.WhiteSpace.ScopeIndent.IncorrectExact)
 27 | ERROR | [x] Expected 4 space(s) before asterisk; 3 found
    |       |     (Drupal.Commenting.DocCommentAlignment.SpaceBeforeStar)
 28 | ERROR | [x] Expected 4 space(s) before asterisk; 3 found
    |       |     (Drupal.Commenting.DocCommentAlignment.SpaceBeforeStar)
 29 | ERROR | [x] Expected 4 space(s) before asterisk; 3 found
    |       |     (Drupal.Commenting.DocCommentAlignment.SpaceBeforeStar)
 30 | ERROR | [x] Expected 4 space(s) before asterisk; 3 found
    |       |     (Drupal.Commenting.DocCommentAlignment.SpaceBeforeStar)
 33 | ERROR | [x] Line indented incorrectly; expected 2 spaces, found
    |       |     3
    |       |     (Drupal.WhiteSpace.ScopeIndent.IncorrectExact)
 34 | ERROR | [x] Expected 4 space(s) before asterisk; 3 found
    |       |     (Drupal.Commenting.DocCommentAlignment.SpaceBeforeStar)
 35 | ERROR | [x] Expected 4 space(s) before asterisk; 3 found
    |       |     (Drupal.Commenting.DocCommentAlignment.SpaceBeforeStar)
 36 | ERROR | [x] Expected 4 space(s) before asterisk; 3 found
    |       |     (Drupal.Commenting.DocCommentAlignment.SpaceBeforeStar)
 37 | ERROR | [x] Expected 4 space(s) before asterisk; 3 found
    |       |     (Drupal.Commenting.DocCommentAlignment.SpaceBeforeStar)
 38 | ERROR | [x] Expected 4 space(s) before asterisk; 3 found
    |       |     (Drupal.Commenting.DocCommentAlignment.SpaceBeforeStar)
 39 | ERROR | [x] Expected 4 space(s) before asterisk; 3 found
    |       |     (Drupal.Commenting.DocCommentAlignment.SpaceBeforeStar)
 40 | ERROR | [x] Expected 4 space(s) before asterisk; 3 found
    |       |     (Drupal.Commenting.DocCommentAlignment.SpaceBeforeStar)
 41 | ERROR | [x] Expected 4 space(s) before asterisk; 3 found
    |       |     (Drupal.Commenting.DocCommentAlignment.SpaceBeforeStar)
 42 | ERROR | [x] Expected 4 space(s) before asterisk; 3 found
    |       |     (Drupal.Commenting.DocCommentAlignment.SpaceBeforeStar)
 43 | ERROR | [x] Expected 4 space(s) before asterisk; 3 found
    |       |     (Drupal.Commenting.DocCommentAlignment.SpaceBeforeStar)
 44 | ERROR | [x] Expected 4 space(s) before asterisk; 3 found
    |       |     (Drupal.Commenting.DocCommentAlignment.SpaceBeforeStar)
 45 | ERROR | [x] Expected 4 space(s) before asterisk; 3 found
    |       |     (Drupal.Commenting.DocCommentAlignment.SpaceBeforeStar)
 46 | ERROR | [x] Expected 4 space(s) before asterisk; 3 found
    |       |     (Drupal.Commenting.DocCommentAlignment.SpaceBeforeStar)
 47 | ERROR | [x] Expected 4 space(s) before asterisk; 3 found
    |       |     (Drupal.Commenting.DocCommentAlignment.SpaceBeforeStar)
 48 | ERROR | [x] Expected 4 space(s) before asterisk; 3 found
    |       |     (Drupal.Commenting.DocCommentAlignment.SpaceBeforeStar)
 71 | ERROR | [x] Whitespace found at end of line
    |       |     (Squiz.WhiteSpace.SuperfluousWhitespace.EndLine)
 82 | ERROR | [x] Whitespace found at end of line
    |       |     (Squiz.WhiteSpace.SuperfluousWhitespace.EndLine)
 91 | ERROR | [x] Whitespace found at end of line
    |       |     (Squiz.WhiteSpace.SuperfluousWhitespace.EndLine)
----------------------------------------------------------------------
PHPCBF CAN FIX THE 25 MARKED SNIFF VIOLATIONS AUTOMATICALLY
----------------------------------------------------------------------


FILE: ...ore/modules/datetime/src/Plugin/Field/FieldType/DateTimeItem.php
----------------------------------------------------------------------
FOUND 2 ERRORS AFFECTING 2 LINES
----------------------------------------------------------------------
 62 | ERROR | [x] Line indented incorrectly; expected 4 spaces, found
    |       |     6
    |       |     (Drupal.WhiteSpace.ScopeIndent.IncorrectExact)
 63 | ERROR | [x] Object operator not indented correctly; expected 8
    |       |     spaces but found 6
    |       |     (Drupal.WhiteSpace.ObjectOperatorIndent.Indent)
----------------------------------------------------------------------
PHPCBF CAN FIX THE 2 MARKED SNIFF VIOLATIONS AUTOMATICALLY
----------------------------------------------------------------------

Time: 12.94 secs; Memory: 6MB
kasey_mk’s picture

StatusFileSize
new98.1 KB

Thanks for the style notes, @daffie - I think this fixes them (plus one other error I found in the process).

I think work for 10.1 is happening on/from [META] Add timezone support to core date fields, and this thread is just to keep those of us using the work-in-progress from a previously at-least-mostly-working patch limping along until that meta issue is resolved.

_utsavsharma’s picture

Status: Needs work » Needs review
_utsavsharma’s picture

StatusFileSize
new928 bytes
new98.1 KB

Fixed CCF for #32 for 9.5.x.
Please review.

Status: Needs review » Needs work

The last submitted patch, 34: 3185750-34.patch, failed testing. View results

liquidcms’s picture

Issue summary: View changes
liquidcms’s picture

NOTE: this is with patch #28 as only one that would apply to 9.4.

I have tested applying this patch on a site running both D9.4.8 and D9.4.10. The patch applies cleanly once i removed this patch #2827055: Add option to show only start or end date in the DateTime Range custom formatter.

Running "drush updb" seems to mostly do its thing by adding TZ column to tables with date columns except i get this error for 1 instance it is trying to update:

"query": "SQLSTATE[42000]: Syntax error or access violation: 1072 Key column 'scheduled_date_value
  ' doesn't exist in table: ALTER TABLE "sitewide_alert_field_data" ADD INDEX `value_timezone` (`scheduled_date_value`,
  `scheduled_date_timezone`); 

this is from the Sitewide Alert module. I suspect this is due to their odd column name for their date property: scheduled_date__value and scheduled_date__end_value. For some reason they have a double underscore. I guess I could raise a bug on that module but not sure Drupal has a requirement for naming of this. More likely this update script should be more encompassing. That being said, the tz field is still added; but only for the start date.

After the patch (and updb) I can now see the UI option for the field settings to "Store a timezone"; but there is no timezone selector added to the widget.

liquidcms’s picture

Hmm, interesting.

I have added new date and daterange fields to an existing bundle (node) and in widget settings i now see the "Preferred time zone for each date" option. Which when selected, does give me a TZ selector on my node form.

My report above was based on setting an existing field (which also happened to be on a paragraph). It does have the TZ options (user/site/fixed) for the widget; but does not have the "Preferred time zone for each date" option.

liquidcms’s picture

It seems as though this only works for new fields (fields with no content). For existing fields there is this message as might be expected: "There is data for this field in the database. The field settings can no longer be changed." and the checkbox to set to "Store a time zone" is disabled, initially. But once the form finishes loading; the disabled attr is gone and i can set the value (which i had done for my test above); but when i go back to edit storage settings i see the checkbox did not get set (which is why the option is not available for the widget).

I suspect a core bug here as well in that it allows me to save the field storage form and tells me it was successful; even though it was not.

UI bugs aside, is this expected operation here? Should this change in storage be disabled due to existing content? The tz field tables were modified regardless; so not sure i see harm in allowing new entries to set tz. And somewhat related; not sure why the tz property is added to date fields but not populated with the default site TZ. Is there a reason we wouldnt populate these? Of course if these fields dont use time then no reason; but the tz field is added to the table regardless of the time setting (I guess thinking is maybe they have no content yet so they could be modified to include time?).

I think the update as it is now: add tz field in all tables and dont prepopulate existing entries with tz is valid. But i think this should also allow changing existing fields (with content) but on that action go in and populate all the existing content with site's default tz.

liquidcms’s picture

deleted.

Version: 10.1.x-dev » 11.x-dev

Drupal core is moving towards using a “main” branch. As an interim step, a new 11.x branch has been opened, as Drupal.org infrastructure cannot currently fully support a branch named main. New developments and disruptive changes should now be targeted for the 11.x branch, which currently accepts only minor-version allowed changes. For more information, see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

natemow’s picture

StatusFileSize
new97.98 KB

Reroll for 10.1.

balagan’s picture

StatusFileSize
new76.45 KB

Reroll off patch #42

kasey_mk’s picture

#42 applied and seems to be working for me on Drupal 10.1.4 with MySQL 10.4.

#43 threw this error: PHP Fatal error: Trait "Drupal\datetime\Plugin\Field\ConfigurableTimezoneTrait" not found in /app/web/core/modules/datetime/src/Plugin/Field/FieldFormatter/DateTimeFormatterBase.php on line 22

Thanks to all keeping this alive!

joseph.olstad’s picture

Issue summary: View changes
joseph.olstad’s picture

Issue summary: View changes

based on feedback in #44

balagan’s picture

StatusFileSize
new97.28 KB

Applying patch in #42 gives me the following error

error: patch fragment without header at line 1127: @@ -23,7 +26,11 @@ class DateTimeFieldTest extends DateTestBase {

I suppose I also got the error in #44, because now I see that I was actually using a local file 3185750-44.patch for patching. I suppose I have forgotten to get back to the issue and attach it. I have renamed it to 3185750-47.patch and will upload it here.

balagan’s picture

StatusFileSize
new97.23 KB

I have rerolled patch #47 against 10.2.x
No conflicts were shown when rebasing.

socialnicheguru’s picture

The patch for 10.2 causes this error:

Site/admin/structure/types/manage/event/fields/node.event.field_date_recur|site/admin/structure/types/manage/event/fields|1||TypeError: Unsupported operand types: string * int in Drupal\datetime\Plugin\Field\FieldType\DateTimeItem->storageSettingsForm() (line 116 of drupal10.2/html/core/modules/datetime/src/Plugin/Field/FieldType/DateTimeItem.php).

borutpiletic’s picture

StatusFileSize
new97.13 KB

I can confirm the same issue as reported in comment #49, after applying patch for branch 10.2.
This can be reproduced if you try to use the Date field storage settings form.
There is a additional plus character at line 726 which breaks form element in the storageSettingForm.

Uploading corrected patch 3185750-48 from balagan.

borutpiletic’s picture

StatusFileSize
new97.23 KB

previous patch had index removed, uploading corrected for 10.2.

kasey_mk’s picture

StatusFileSize
new96.53 KB
new0 bytes

Re-roll of patch in #51 for 10.3 / 11

kasey_mk’s picture

kasey_mk’s picture

StatusFileSize
new96.08 KB

Oops; I'd introduced an error on /core/modules/datetime_range/src/DateTimeRangeTrait.php and /core/modules/datetime_range/src/Plugin/Field/FieldFormatter/DateRangeCustomFormatter.php - I think this fixes it.

veronicaseveryn’s picture

Patch #54 didn't quite work for me.
Timezone was still not applicable on the front-end (if selected "Use time zones from individual dates").
After debugging I found the missing piece to it.

I have added a $timezone param to renderStartEndWithIsoAttribute(...) function, so it can accept the value from inside viewElements() function call.

Attached a fix based on #54 , which is also re-rolled for 10.3.x branch.

andrtroe’s picture

StatusFileSize
new98.21 KB

There is a bug if field is added to a paragraph and user uses collapse/expand operations time changes every time.
Added a fix for this based on patch from #55.

Version: 11.x-dev » main

Drupal core is now using the main branch as the primary development branch. New developments and disruptive changes should now be targeted to the main branch.

Read more in the announcement.

kasey_mk’s picture

StatusFileSize
new98.21 KB

When I updated to PHP 8.4 I started getting some errors like this:
Deprecated function: Drupal\datetime\Plugin\Field\FieldFormatter\DateTimeFormatterBase::__construct(): Implicitly marking parameter $config_factory as nullable is deprecated, the explicit nullable type must be used instead in include() (line 576 of /app/vendor/composer/ClassLoader.php).

This is pretty easily solvable by adding a "?" to all the instances of "ConfigFactoryInterface $config_factory = NULL" in this patch as follows:
?ConfigFactoryInterface $config_factory = NULL

So that's what's changed in this version of the patch from #56 (for all four instances of that bit of code).

natemow’s picture

StatusFileSize
new98.08 KB

Reroll for 11.3.5.

natemow’s picture

StatusFileSize
new98.41 KB

Reroll for 11.3.5, this time accounting for now-obsolete `system_time_zones()`.