Problem/Motivation

As part of #2999721: [META] Deprecate the legacy include files before Drupal 9, deprecate date_iso8601().

Proposed resolution

  1. Deprecate date_iso8601($timestamp) in favour of PHP date('c', $timestamp)

Remaining tasks

None.

User interface changes

None.

API changes

  • date_iso8601() is deprecated.

Data model changes

None.

Comments

claudiu.cristea created an issue. See original summary.

claudiu.cristea’s picture

Status: Needs work » Needs review
Parent issue: » #2999721: [META] Deprecate the legacy include files before Drupal 9
StatusFileSize
new52.81 KB

Patch.

claudiu.cristea’s picture

StatusFileSize
new13.22 KB

Dammit, added also the composer.lock in the patch :)

claudiu.cristea’s picture

Issue tags: +@deprecated, +Kill includes

The last submitted patch, 2: 2999989-2.patch, failed testing. View results

Status: Needs review » Needs work

The last submitted patch, 3: 2999989-3.patch, failed testing. View results

mpdonadio’s picture

Thinking out loud here, but if the callable issue is limited to the migrations, can we add this as a helper class there instead of Component? Can the format_date migrate plugin be used?

claudiu.cristea’s picture

Status: Needs work » Needs review
StatusFileSize
new14.22 KB
new12.64 KB

Yeah, a component is too much. In fact the function has been used only by the RDF module (not only migration), so I propose that:

  • We deprecate date_iso8601($timestamp) in favour of PHP date('c', $timestamp)
  • We create a helper class only in rdf.module, with the method to be statically called.

How about that?

claudiu.cristea’s picture

Issue summary: View changes

Fixed the IS & CR.

andypost’s picture

Good compromise

+++ b/core/includes/common.inc
@@ -331,16 +331,20 @@ function format_date($timestamp, $type = 'medium', $format = '', $timezone = NUL
- * @param $date
+ * @param string $timestamp
...
-function date_iso8601($date) {
...
+function date_iso8601($timestamp) {

any reason to change signature?

claudiu.cristea’s picture

Status: Needs review » Needs work

Unfortunately, the change of migrate source data should not have been done. The migration trick doesn't work. I have to investigate more.

quietone’s picture

Came across this and just noting that #2998666: Warnings after D7 upgrade caused by rdf migration has been committed which implements the most of the rdf changes in the patch in #8.

sjerdo’s picture

jcnventura’s picture

Status: Needs work » Needs review
StatusFileSize
new1.64 KB

Re-roll of #8, after #2998666: Warnings after D7 upgrade caused by rdf migration.

No interdiff because it's way, way larger than the new patch.

Status: Needs review » Needs work

The last submitted patch, 14: 2999989-14.patch, failed testing. View results

jcnventura’s picture

Status: Needs work » Needs review
StatusFileSize
new1.48 KB
new2.08 KB

Ah well, that function is not actually testing date_iso8601(), but the callback mechanism. There's a timezone difference between using date_iso8601(), which seems to be using UTC+10, and CommonDataConverter::dateIso8601Value() which uses UTC.

Changing ISO date to also use UTC fixes the test, keeping it virtually the same as before.

jcnventura’s picture

Issue summary: View changes
quietone’s picture

Status: Needs review » Reviewed & tested by the community

I read on d.o somewhere that the timezone for tests is Sydney/Australia which explains the UTC+10, but I can't find that page again.

Installed the patch and checked why the change to UTC. The change to UTC is necessary because CommonDataConverter assumes a format of UTC. I don't quite get why that is but then converting a time to UTC shouldn't be a problem. As stated in the issue where that was committed

updated the tests to use format_date, and Drupal\rdf\CommonDataConverter() to use \Drupal::service('date.formatter'), and both to force the timestamp to UTC (which shouldn't matter for this purpose, since the TZ offset it part of the output and will be interpreted by anything using it). Not sure if the CommonDataConverter() part would really be considered in scope, but we have a service for formatting timestamps, so we should use it instead of the low level function.

catch’s picture

Status: Reviewed & tested by the community » Fixed

Committed e1c3458 and pushed to 8.7.x. Thanks!

  • catch committed e1c3458 on 8.7.x
    Issue #2999989 by claudiu.cristea, jcnventura, quietone: Deprecate...

Status: Fixed » Closed (fixed)

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

quietone’s picture

publish change record