adobe / adobe/aio-lib-java

`aem` Date format not compatible with ECMA Script

オープン
#103 コメント 1 件 リアクション 0 件 担当者 0 名 GitHub で見る
主要言語
Java
スター
7
フォーク
22
PR マージ指標
30日以内にマージされた PR はありません

説明

Events produced by `aem` have the form:

```
{
"event_id": "2e38cbbe-4426-468c-b5ff-a8940e3210a6",
"event": {
"@id": "urn:oeid:aem:779885b1-f2fa-480d-b0c0-5a93619c5d29",
"@type": "xdmCreated",
"activitystreams:published": "2021-03-16T10:54:47.037+01",
"activitystreams:to": {
"@type": "xdmImsOrg",
"xdmImsOrg:id": "B28447B65D88A19F0A495C33@AdobeOrg"
},

```
...


Unfortunately, the JavaScript methods Date.parse() or new Date() cannot parse Date-Strings like that one:

`2021-03-16T10:54:47.037+01 //ERROR!!`

(even though it's proper ISO-8601) The correct format is

`2021-03-16T10:54:47.037+01:00`

With the additional minute-denominator in the timezone (yes - there are half-hour time zones on the globe ..)

What also is allowed is `2021-03-16T10:54:47.037Z`
for "Zulu-time" which is equivalent to "+00:00"

Now we should assume that 90% of the receivers are implemented in I/O runtime and thus implemented in JS. So I think it's worth the effort fixing it.

You can argue, that this can easily be done with a regex in the client code...
BUT: Most of the time I received valid events with "Z" timezone.. and my code worked perfectly well.
Until now, when I saw these "incomplete" "+01" showing up in the queue..
and my perfectly working code stopped working

BTW: "+01:00" also is perfectly ISO-8601 compatible... so it should be safe to use that format instead.

コントリビューションガイド

コントリビューションガイドを開く

調査の方向性

まず、aem の `activitystreams:published` 値を生成するイベントシリアライゼーションを特定してください。issue には現在の形式と望ましい形式の例が示されています。出力されるタイムスタンプを JavaScript の `Date.parse()` または `new Date()` で確認し、タイムゾーンに分の要素が含まれるか `Z` を使用し、結果のイベントが有効な ISO-8601 のままであれば issue は完了とみなします。

索引モデルが issue の本文から書いたものです。

評価

技術スタック
java, javascript
領域
api, backend
issue の種類
バグ
難易度
2/5
見積もり時間
1〜3時間
活発さ
停滞
明瞭さ
おおむね明確
初心者へのやさしさ
35/100

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。