Updated: Comment #0

Problem/Motivation

If you create a custom date-format and then try to edit it without changing the format, you receive an error 'This format already exists. Enter a unique format string.'

Proposed resolution

Fix it

Remaining tasks

Review

User interface changes

None

API changes

None

Test patch coming

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

larowlan’s picture

Status: Active » Needs review
FileSize
1.33 KB
1.33 KB

Something like this.
Simpletest playing up locally so hoping for red/green but could be wrong

larowlan’s picture

FileSize
2.18 KB

Wrong patch for .pass

Status: Needs review » Needs work

The last submitted patch, date-time-pass.patch, failed testing.

larowlan’s picture

+++ b/core/modules/system/lib/Drupal/system/Form/DateFormatFormBase.php
@@ -197,7 +197,7 @@ public function validate(array $form, array &$form_state) {
+      if ($format->getPattern() == $pattern && $format->id() != $this->entity->id()) {

will probably need a check for isNew() too

herom’s picture

Status: Needs work » Needs review
FileSize
2.18 KB
1.33 KB
915 bytes

new patch.

larowlan’s picture

Includes #4

tim.plunkett’s picture

+++ b/core/modules/system/lib/Drupal/system/Tests/System/DateTimeTest.php
@@ -96,6 +96,13 @@ function testDateFormatConfiguration() {
+    $this->assertEqual($this->getUrl(), url('admin/config/regional/date-time', array('absolute' => TRUE)), 'Correct page redirection.');

This can be assertUrl(), right?

Otherwise this is great.

herom’s picture

larowlan’s picture

Status: Needs review » Reviewed & tested by the community

as per #7

alexpott’s picture

Status: Reviewed & tested by the community » Fixed

Committed 885ac82 and pushed to 8.x. Thanks!

Status: Fixed » Closed (fixed)

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