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

Comments

larowlan’s picture

Status: Active » Needs review
StatusFileSize
new1.33 KB
new1.33 KB

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

larowlan’s picture

StatusFileSize
new2.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
StatusFileSize
new2.18 KB
new1.33 KB
new915 bytes

new patch.

larowlan’s picture

StatusFileSize
new2.21 KB
new1.81 KB

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

StatusFileSize
new929 bytes
new2.18 KB

#7 done.

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.