Child pages
  • Allow specifying default value for date/time picker [5.3.0-B1]
Skip to end of metadata
Go to start of metadata

The forms in In-Portal are built from blocks. There are blocks for almost any control that exists, e.g. checkbox, radio buttons, date pickers.

The control in questions is "inp_edit_date_time", that allows to specify date & time by:

  • entering by hand in the corresponding inputs
  • selecting using date picker control

When date picker is opened and user haven't specified any value in the associated inputs, then date/time of date picker control opening moment is used:

The only of fixing this is ability to specify default date/time for the picker control for cases, when no value is entered by user yet.

Solution

  1. the new "picker_default" field option would be implemented, that can have 2 type values:
    1. exact timestamp
    2. relative timestamp in any format supported by "strtotime" function (e.g. "midnight +1 day -1 second" would resolve to "23:59:59" of today)
  2. the new "picker" format would be added to "kDateFormatter" class, that would work like this:
    1. if field does have value take it
    2. if field doesn't have any value AND "picker_default" is specified, then use above rules to create desired timestamp
    3. format timestamp from above using default format of the field (as if empty "format" was specified instead of "picker")
  3. in the "inp_edit_date_time" control use "picker" format (instead of no format) for the hidden field, that name starts with "full_date_"

Related Tasks

INP-1531 - Getting issue details... STATUS

2 Comments

  1. Sponsored by rRPI22232.

  2. This time picker does not work correctly with seconds, so format "midnight +1 day -1 second" after picker usage resolves to "23:59:00", not to "23:59:59". Maybe, additional changes to picker code are necessary.