DateTimePicker's onChange functionality?

Hello,
I have been using the DateTimePicker Widget and have stumbled across some problems…

I have the usecase where I need the date and the time argument seperately.
Currently I am solving it by using onScreenChange(which is not triggered on showing the DateTimePicker) to track the current screen (date, hour, minute) and the onChange to only get the necessary information via the current screen I am in.

This seems a little complicated… and I was wondering, is there another way?

Also, when using the onChange, it can either supply the handler with one argument or two.
When two arguments are used, the argument’s names are time and date. However, there never seems to be any difference between the date and the time argument.

And is there a way to manipulate the default value that is set for the time? When I use CLEAR, the onChange arguments are undefined which is nice! But when I choose a new date, the date and the time arguments are the same again with a default time of 1 o’clock which is a little confusing.

Greetings Mino

Hi Mino,
You can seperate the data and time information from the DateTimePicker using a computation rule. You can see this happening in the gif below.
DateTimeTest
Here’s what I did in the Simple Model Editor:

  1. Created a Field for the DateTimePicker
  2. Created a Field for the Date (Data Type = Date)
  3. Created a Computational Rule which referenced the Date Field and added the calculation DateFromDateTime(NameOfDateTimePickerField)
  4. Repeated steps 2 and 3 for the time field (Data Type = Time, Operation = TimeFromDateTime)

You need to set up the fields for the date and time information correctly as these operations will not work with a string or number field. If you need more information, you can use this link to the documentation (geta12.com, Modeling, Basic Modeling, Validation, 5.10.24 DateFromDateTime).

Hope this helps,
Malcolm