0

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.

Community
  • 1
  • 1
  • Please, provide code snippet. – Frantisek Kossuth Jan 23 '15 at 11:56
  • 1
    I don't see another way than correcting Date field in postSaveDocument event with .setAnyTime() like shown in question's link http://stackoverflow.com/a/19662232/2065611 or your solution with custom renderer and component for datetimehelper. – Knut Herrmann Jan 23 '15 at 13:10

1 Answers1

0

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.

Paul Stephen Withers
  • 15,699
  • 1
  • 15
  • 33
  • With some weird combination of timeZone properties I got 13:00, but I didn't investigate further. In worst case I can use setAnyTime with sessionAsSigner in postSaveDocument when user doesn't have edit rights anymore. Probably even OpenNTF Domino API is no help here :) – Martin Pradny Jan 23 '15 at 15:02
  • Bear in mind that a date only field *cannot* have a timezone (same also for a time only field). If you retrieve the DateTime object and try to check the timezone it will return a negative number. – Paul Stephen Withers Feb 04 '15 at 09:54