Time, The date picker is six hours longer | Community
Skip to main content
Level 2
March 5, 2025

Time, The date picker is six hours longer

  • March 5, 2025
  • 3 replies
  • 1062 views

我将再次使用 datepicker 在对话框中配置时间。但是我使用了标头 applysTime: 打印出新的 Date (properties.applysTime 的getTime()),并且 “headerpapplysTime”: “2025-03-05T15:14:00.000Z” 比我配置的要长 6 小时。我的配置如下

 

 

3 replies

Tethich
Community Advisor
Community Advisor
March 5, 2025

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.

guodonghaAuthor
Level 2
March 5, 2025

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

 

 

 

Tethich
Community Advisor
Community Advisor
March 5, 2025

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"

 

kautuk_sahni
Community Manager
Community Manager
April 1, 2025

@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!

Kautuk Sahni