Hi all,
I was create a field for the user select time only. I set for the field as below:
displayedFormat: HH:mm
storedValue: HH:mm
type: time
valueFormat: HH:mm
However, it save to the JCR:Content as : 2018-08-10T11:16:00.000+07:00
And it can't display when I go to view properties page to edit.
How to save the time as HH:mm example: 11:16 ?
How to display it in the edit form after save it?
Thank you so much,
BienHV
Solved! Go to Solution.
Views
Replies
Total Likes
When you speak of "form", I assume that you are talking about page properties or component properties, is that correct?
In this case, the Sling Post Servlet handles the conversion of the date into a property with the JCR type "date". And the way, which CRXDE Lite is displaying it (I assume that you took the formatting from there) is one way to display it. That means, your simplified approach to store "time" is handled by the system in a way to store it as full "date object" including minutes, seconds, timezone etc.
Tat way you should also treat the object as full "date object" and format it according to your needs on the client side.
Jörg
When you speak of "form", I assume that you are talking about page properties or component properties, is that correct?
In this case, the Sling Post Servlet handles the conversion of the date into a property with the JCR type "date". And the way, which CRXDE Lite is displaying it (I assume that you took the formatting from there) is one way to display it. That means, your simplified approach to store "time" is handled by the system in a way to store it as full "date object" including minutes, seconds, timezone etc.
Tat way you should also treat the object as full "date object" and format it according to your needs on the client side.
Jörg
Hi,
As Jorg suggested you cans ave date as it is but manipulate during display.
Or you can you below document to set date formats while saving and displaying? Please check if it helps.
DatePicker — Granite UI 1.0 documentation
Views
Replies
Total Likes
Are you working with the coral 3 date picker object?
Views
Replies
Total Likes
Thanks for your helps.
I do it in the coral UI. I can choose only time in the form. But it save date and time. And when I choose View properties of page to edit. It can't display the time I selected before. The requirement are select and save only time. I don't want to save date.
Please suggest me the solutions.
Thank you so much.
BienHV
Views
Replies
Total Likes
Hi,
You can save both date and time but when you use on page, you can only get time in HTL like below example to get last replication date
<p>Time - ${'HH:mm' @ format=pageProperties.cq:lastReplicated }</p>
Similar you you can do
${'HH:mm' @ format=properties.propName}
${'HH:mma' @ format=properties.propName}
Views
Replies
Total Likes
Views
Likes
Replies
Views
Like
Replies
Views
Likes
Replies