adobe / adobe/aio-lib-java

`aem` Date format not compatible with ECMA Script

Đang mở
#103 1 bình luận 0 reaction 0 người được giao Xem trên GitHub
Ngôn ngữ chính
Java
Star
7
Fork
22
Chỉ số merge pull request
Không có pull request nào được merge trong 30 ngày

Mô tả

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.

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Hướng nghiên cứu

Bắt đầu bằng cách xác định phần tuần tự hóa sự kiện tạo ra giá trị `activitystreams:published` của aem; issue cung cấp các ví dụ về định dạng hiện tại và định dạng mong muốn. Kiểm tra dấu thời gian được xuất ra bằng JavaScript `Date.parse()` hoặc `new Date()`, và coi issue là hoàn tất khi múi giờ bao gồm thành phần phút hoặc sử dụng `Z`, đồng thời sự kiện kết quả vẫn là ISO-8601 hợp lệ.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Đánh giá

Công nghệ
java, javascript
Lĩnh vực
api, backend
Loại issue
Lỗi
Độ khó
2/5
Thời gian dự kiến
1-3 giờ
Mức độ hoạt động
Đình trệ
Độ rõ ràng
Khá rõ ràng
Mức phù hợp với người mới
35/100

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.