0
votes

I use standard dojo date picker and it works fine. Only problem is that actual value that is saved to the document has always 12:00:00 time part. I assume it probably tries to set 12 AM, but since I'm in Europe (CET time zone) it really means noon.

This is quite annoying when I try to do date/time comparison later.

I found posts how I can strip time part completely, e.g. XPages - save date only in Date field , but it needs extra code in post save and in some cases I can't use post save because of access rights.

I understand that XPages work with Java Date that has no option for date only, but at least it should return just 00:00, not 12:00. When I tried to play with timezone setting on the converter I got even different time values in the field.

I was able to change the behavior using custom renderer and component for the datetimehelper, but it is really an overkill. Standard implementation bypasses used convertor, so just custom converter didn't help.

Is there any way how to force the date field to just return date with 00:00 time part? I don't expect any magic where it would save just dateonly field to the document.

Thanks, M.

1
Please, provide code snippet.Frantisek Kossuth
I don't see another way than correcting Date field in postSaveDocument event with .setAnyTime() like shown in question's link stackoverflow.com/a/19662232/2065611 or your solution with custom renderer and component for datetimehelper.Knut Herrmann

1 Answers

0
votes

No, it's not trying to set 12am and being affected by timezone, what you're seeing is standard. I think it started with 9.0. I suspect the timing is to avoid impacts from Daylight Savings Time changes.

One option is to call .setAnyTime() on the DateTime object for the field.