Incorrectly calculates the datetime property for <time>

Created on 17 October 2023, over 1 year ago

Problem/Motivation

$iso_date = $date->format('Y-m-d\TH:i:s', ['timezone' => $item->timezone]) . 'Z';

The current code calculates the datetime property using the specified timezone but then sets the timezone to UTC(Z). This is incorrect and the code should _always_ calculate the time in UTC.

Also we can just use the internal PHP ISO constant.

Steps to reproduce

An example generated code where we see the visible value as 1:26PM Central Standard Time and the machine value as 1PM UTC.

<time datetime="2027-12-22T13:26:02Z">Wednesday, 1:26pm CST</time>

Proposed resolution

Calculate the ISO date like this:

$iso_date = $date->format(\DateTimeInterface::ATOM, ['timezone' => 'UTC']);

Remaining tasks

User interface changes

API changes

Data model changes

🐛 Bug report
Status

Needs review

Version

1.0

Component

Code

Created by

🇺🇸United States neclimdul Houston, TX

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Production build 0.71.5 2024