Hi,
I'm working with OXPro 7.3.3. I'm building a planning module for our administration application so I need a 'Planningline' where the user can enter a date and time range for that particular task.
So I have following module:
I made a custom editor 'LocalDateTimeSeparatedCalendar' that accepts LocalDateTime objects instead of 'Timestamp'. (I know this is coming up in version OX 7.4 but I couldn't wait...;-). Hence I duplicated 'dateTimeSeparatedCalendarEditor.jsp' to my local customEditor folder and named it 'LocalDateTimeSeparatedCalendarEditor.jsp', I duplicated 'DateTimeBaseFormatter.java' to my projects formatter package as 'LocalDateTimeBaseFormatter.java' and 'timeCalendarEditor.jsp' to 'localTimeCalendarEditor.jsp'. I corrected all references to their relevant values and I altered the formatter so LocalDateTime objects are saved to the database instead of Timestamp objects. Everything works: The entered dates and times are stored in the database and re-displayed when the record is in detail mode except for the time part. There there is a flatpickr issue (I guess). The locale is 'nl' (for dutch) and in the file '/openxava-7.3.3-sources/META-INF/resources/xava/editors/flatpickr/nl.js' the option is set to 'time_24hr: true'. So I expect to handle the time values in 24H mode not in AM/PM mode. In the detail editor AM/PM is not displayed and I can enter a value like '15:20'. When I save I see that the listeditor displays it as '3:20PM'. For now, that's ok with me, but: If I re-open the record in detail mode it displays '3:20' and when I save without touching anything but the save button, the list mode shows '3:20AM'.
So, somehow flatpickr handles the time values wrongly. I tried to force 'time_24hr' to true by changing 'localTimeCalendarEditor.jsp' from:
with no luck. I googled 'data-time_24hr="true"' and this is a valid data attribute. Also I logged the outcome of 'data-date-format="<%=org.openxava.util.Dates.timeFormatForJSCalendar()%>"' which is 'H:i' which is correct as 'H' stands for 24-hour notation.
I really don't know what I can do next to solve this issue. Thanks in advance for any input!
Kind regards,
Bart.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Ok, I found what is wrong. I reworked the formatters to handle LocalDateTime and in DateTimeFormatter.ofPattern("dd/MM/yyyy hh:mm") I used 'hh' instead of 'HH'. Lowercase 'h' means 12 hour system, uppercase is 24 hour system. So everything works like expected now. Sorry for the inconvenience.
Kind regards,
Bart.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hi,
I'm working with OXPro 7.3.3. I'm building a planning module for our administration application so I need a 'Planningline' where the user can enter a date and time range for that particular task.
So I have following module:
I made a custom editor 'LocalDateTimeSeparatedCalendar' that accepts LocalDateTime objects instead of 'Timestamp'. (I know this is coming up in version OX 7.4 but I couldn't wait...;-). Hence I duplicated 'dateTimeSeparatedCalendarEditor.jsp' to my local customEditor folder and named it 'LocalDateTimeSeparatedCalendarEditor.jsp', I duplicated 'DateTimeBaseFormatter.java' to my projects formatter package as 'LocalDateTimeBaseFormatter.java' and 'timeCalendarEditor.jsp' to 'localTimeCalendarEditor.jsp'. I corrected all references to their relevant values and I altered the formatter so LocalDateTime objects are saved to the database instead of Timestamp objects. Everything works: The entered dates and times are stored in the database and re-displayed when the record is in detail mode except for the time part. There there is a flatpickr issue (I guess). The locale is 'nl' (for dutch) and in the file '/openxava-7.3.3-sources/META-INF/resources/xava/editors/flatpickr/nl.js' the option is set to 'time_24hr: true'. So I expect to handle the time values in 24H mode not in AM/PM mode. In the detail editor AM/PM is not displayed and I can enter a value like '15:20'. When I save I see that the listeditor displays it as '3:20PM'. For now, that's ok with me, but: If I re-open the record in detail mode it displays '3:20' and when I save without touching anything but the save button, the list mode shows '3:20AM'.
So, somehow flatpickr handles the time values wrongly. I tried to force 'time_24hr' to true by changing 'localTimeCalendarEditor.jsp' from:
to
with no luck. I googled 'data-time_24hr="true"' and this is a valid data attribute. Also I logged the outcome of '
data-date-format="<%=org.openxava.util.Dates.timeFormatForJSCalendar()%>"
' which is 'H:i' which is correct as 'H' stands for 24-hour notation.I really don't know what I can do next to solve this issue. Thanks in advance for any input!
Kind regards,
Bart.
Ok, I found what is wrong. I reworked the formatters to handle LocalDateTime and in
DateTimeFormatter.ofPattern("dd/MM/yyyy hh:mm")
I used 'hh' instead of 'HH'. Lowercase 'h' means 12 hour system, uppercase is 24 hour system. So everything works like expected now. Sorry for the inconvenience.Kind regards,
Bart.