Hi!
I'm currently facing a strange issue:
I've a component that includes text inputs and a date picker (Resource Type: granite/ui/components/foundation/form/datepicker).
I can add and edit values for all input fields and they are shown properly on the component on the edited webpage.
The system also stores all values properly.
But when I re-open the dialog the value for the date selected via date picker is not shown. The date picker input field remains empty.
All other inputs are prepopulated with the stored values.
The date is shown on the component but not in the date picker.
If I save the dialog with the empty date picker value the date will be overwritten with null.
Any idea what I can do to show the entered date there?
Thanks and best regards
Sebastian
Solved! Go to Solution.
Ah ok, you are using type="date" (the first property of your datepicker) this is what i meant.
I see your problem, you are using just type=date but by default this is storing in date-time format and thats why the dialog is not able to display the value.
2 Solutions-
1. If you want to retain type="date", have the additional property storedValue something like storedValue="YYYY-MM-DD" make sure you are not specifying time
2. change type="datetime", you don't need to specify the storedValue property in this case, and this lets you specify the time too.
Observe the content node for the stored value. You can use the properties accordingly for display purpose.
Views
Replies
Total Likes
Hi Sebastian,
Have you specified the displayedFormat property?
Like: displayedFormat=YYYY-MM-DD
Which type are you using date, datetime, time,...?
Views
Replies
Total Likes
Hi Vinay,
these are the properties of the datepicker:
type=date (string)
displayedFormat=YYYY-MM-DD (string)
jcr:primaryType=nt:unstructured (name)
name=./jcr:startdate (string)
sling:resourceType=granite/ui/components/foundation/form/datepicker (string)
fieldLabel=Start Date (string)
fieldDescription=Enter Start Date (string)
I'm using "java.util.Date startdate = properties.get("jcr:startdate", java.util.Date.class);" to get the input and use it in my JSP component file.
This is an example output of the startdate value without any formatting: Tue Mar 28 00:00:00 CEST 2017
I don't see any further information about the date type itself whether it's date, datetime or time.
Thanks
Sebastian
Views
Replies
Total Likes
Ah ok, you are using type="date" (the first property of your datepicker) this is what i meant.
I see your problem, you are using just type=date but by default this is storing in date-time format and thats why the dialog is not able to display the value.
2 Solutions-
1. If you want to retain type="date", have the additional property storedValue something like storedValue="YYYY-MM-DD" make sure you are not specifying time
2. change type="datetime", you don't need to specify the storedValue property in this case, and this lets you specify the time too.
Observe the content node for the stored value. You can use the properties accordingly for display purpose.
Views
Replies
Total Likes
Thanks-a-lot for your help, Vinay. Problem solved.
Views
Replies
Total Likes
Hi REES,
I am having the same issue with the datepicker. Below is how the datepicker is configured. I tried using type="date" but still no use. It works if i use type="datetime" but i want to use date only so can you please provide some information on how you were able to solve the issue?
<articleDate fieldLabel="Date" name="./articleDate" sling:resourceType="granite/ui/components/foundation/form/datepicker" displayedFormat="MMM-DD-YYYY" valueFormat="YYYY-MM-DD" storedValue="YYYY-MM-DD" jcr:primaryType="nt:unstructured"/>
Views
Replies
Total Likes
It was a bug, which has been fixed in CFP7.
NPR-15384: HotFix for GRANITE-16481
Here is the link. Adobe Experience Manager Help | Release Notes: AEM 6.1 Cumulative Fix Pack
The issue is only in chrome browser.
Thanks,
Thilak
how can we get the value in htl ?
${properties.articleDate} does not work . I would need time and date .
i don't want to create a java class to read this datetime node . Is there any other way in 6.1 ?
Views
Replies
Total Likes
try this:
${properties.articleDate.getTime.toString}
Views
Likes
Replies
Views
Like
Replies