Skip to Main Content
Feature Request FR-3392
Product Area User Interface
Status CLOSED

5 Voters

Date Picker - Match the value typed in the date field to the format mask.

zolo Public
· Sep 25 2023

Idea Summary
Match the value typed in the date field to the format mask.

Examples:
Item value + Format mask --> New item value
20230925 + YYYY.MM.DD --> 2023.09.25
20230925 + YYYY.MM.DD HH24:MI:SS --> 2023.09.25 00:00:00
202309251155 + YYYY.MM.DD --> 2023.09.25
202309251155 + YYYY.MM.DD HH24 --> 2023.09.25 11
202309251155 + YYYY.MM.DD HH24:MI --> 2023.09.25 11:55
202309251155 + YYYY.MM.DD HH24:MI:SS --> 2023.09.25 11:55:00

This small feature would significantly speed up the manual recording of date values.

We reviewed this idea carefully, and while it was interesting, we concluded that it is unlikely to make its way into APEX in the foreseeable future.

Comments

Comments

  • joep.hendrix OP 1.7 years ago

    You could use jQuery mask

  • zolo OP 1.7 years ago

    Thank you for your solution joep.hendrix, I wrote my proposal because it would be better if apex knew the mask matching functions natively / declaratively. These are not very complicated things, but if there was a unified support within APEX, we could save a lot of time.

  • joep.hendrix OP 1.7 years ago

    Agree, it is just a workaround and it works very nice because the end will see the dashed or points inserted automatically when typing.

  • leonardo.r.rodriguez APEX Team OP 1.6 years ago

    Hi @zolo  thank you for posting this, would you mind providing more information, possibly some examples on how this would work?

  • zolo OP 1.6 years ago

    My current solution only supports the YYYY.MM.DD format, so it cannot be called universally functional.

    Steps:

    1. Create Changed event on the page:   SetDateFormatJS
      Event: Change
      Selection Type: jQuery Selector
      jQuery Selector: .apex-item-text.apex-item-datepicker
       

    2. Create Dynamic Actions:
      Action: Execute JavaScript Code
      Settings:

      let e = this.triggeringElement.id.replace("_input","");
      let d = apex.item(e).getValue().replaceAll('.','').replaceAll(' ','').replaceAll('-','').replaceAll('/','').replaceAll(',','');
      if (d.length == 6 && d.substr(0,2) != '20') {
       d = '20' + d;
      }
      if (d.length == 8 && d.indexOf(".")==-1 && apex.item(e).format == "YYYY.MM.DD") {    
         apex.item(e).setValue(
             d.substr(0,4) + "." + d.substr(4,2) + "." + d.substr(6,2)
         );
      }

    and that's it, it works …

  • vincent morneau Admin OP 1.5 years ago

    Hi @zolo ,

    We've been talking about how to allow masking on APEX items. Other use cases such as credit card format, zip code, and currency are all valid and often requested. We are closing this idea for now, because it's unclear that we can deliver on date picker format mask without looking at the bigger picture, but we keep thinking about masking in general.