how to default time in date time field on page load.

Certified Senior Developer

I have a requirement to show the default time for eg 12:00 Am in the date-time component when the page gets loaded.

Date should be blank .

  Discussion posts and replies are publicly visible

Parents Reply
  • Similar to what Mike noted, you can always use a combination of 2 fields with a!sideBySideLayout().  Date field (no default) for the date portion, then a text field with validation, or dropdown, etc for the time field - combine back together during save from local variables into your CDT.

    a!localVariables(
      local!date: null,
      local!time: "12:00 AM",
      a!sideBySideLayout(
        items: {
          a!sideBySideItem(
            width: "MINIMIZE",
            item: a!dateField(
              label: "Date",
              value: local!date,
              saveInto: local!date
            )
          ),
          a!sideBySideItem(
            width: "MINIMIZE",
            item: a!textField(
              label: "Time",
              value: local!time,
              saveInto: local!time
            )
          )
        }
      )
    )

Children