我将再次使用 datepicker 在对话框中配置时间。但是我使用了标头 applysTime: 打印出新的 Date (properties.applysTime 的getTime()),并且 “headerpapplysTime”: “2025-03-05T15:14:00.000Z” 比我配置的要长 6 小时。我的配置如下
Views
Replies
Total Likes
Hi @guodongha
Can you look and share what values you have stored in JCR properties, then what values you have in the JS properties object ?
You will need to debug and check what happens with the time value from the moment it is stored in AEM to the point you use it in JS code. I suspect it has something to do with the timezone. You enter a value in the dialog field, but somewhere along the way it sets a timezone (maybe it does it as a default behavior) which makes that time difference of 6 hours.
The time values that you see in the page might be UTC times, because I see a 000Z which stands for Zero timezone, meaning 0 offset from the Coordinated Universal Time (UTC). This denotes times are in UTC.
Also, I think you will get better help if you write your messages in English.
In the JCR node, the+8 time zone is displayed. What I don't quite understand is why I added 6 to the 09:14 time after outputting it, which turned it into 15:14
Views
Replies
Total Likes
It is not 6h difference. It is actually 8 h difference, that is how much is between 9 am and 15 pm. Which is exactly hot the timestamp says it should be:
Try to add a Z at the end of you displayFormat property definition. Something like this:
displatFormat="YYYY-MM-DD HH:mm Z"
that is how much is between 9 am and 15 pm.From 9am to 3pm, it's still 6 hours. I don't quite understand how eight hours come about
Views
Replies
Total Likes
displatFormat="YYYY-MM-DD HH:mm Z"
This should just be about the display format of time! It has nothing to do with the time I configured and the time obtained through the new date, right! The storage time of JCR node is 2025-03-05T09:14:00.0000+08:00, but I converted the time using new Date (properties. activityTime. getTime()); 2025-03-05T15:14:00.000Z; The difference between these two times is six hours, not eight hours
displatformat add Z ;Just added display+8:00 as shown in the above picture
Views
Replies
Total Likes
Can you log the value from properties.activitySTime.getTime() to see exactly what is it ?
@guodongha Did you find the suggestions helpful? Please let us know if you need more information. If a response worked, kindly mark it as correct for posterity; alternatively, if you found a solution yourself, we’d appreciate it if you could share it with the community. Thank you!
Views
Replies
Total Likes
Views
Likes
Replies
Views
Likes
Replies
Views
Likes
Replies
Views
Likes
Replies