In Drupal 7 we implemented hook_node_validate() to validate the scheduling fields when a node form is submitted. In Drupal 8 this should be done using validation constraints.

  • If the 'unpublish on' field is filled in we should validate whether the entered date corresponds to the configured date format.
  • If the validation fails, display the following error message:

    The 'unpublish on' value does not match the expected format of %time

  • Also remove the corresponding lines from scheduler_node_validate().

See change record: Entity level validation constraints can be added and the documentation page for the Entity Validation API.

This is postponed on #2490570: Validate that the 'publish on' value matches the expected format.

Comments

jonathan1055’s picture

jonathan1055’s picture

Status: Postponed » Closed (works as designed)

The validation is no longer required now that the format is not configurable - see #2799869: Date field placeholder text doesn't reflect date format defined in admin settings - hardcode the format