We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date
close icon

Controller only recognizes "AM" and "PM" as valid inputs but not "am" or "pm"

The DateTimePicker controller only accepts "AM" and "PM" as valid values for the time, but I would like to be able to use lowercase version as well ("am", "pm"). Is there a way to achieve this?

7 Replies

SP Sureshkumar P Syncfusion Team November 2, 2022 05:51 AM

Hi Thien,

In our 19.1.56 version onwards, we have changed when you enter lowercase meridian values (am or pm), the values are automatically converted to AM or PM. This is the default behavior of our component.

Note: If this post is helpful, please consider Accepting it as the solution so that other members can locate it more quickly.


Sureshkumar P

TN Thien Nguyen November 2, 2022 11:42 AM

Hi Sureshkumar P,
Thanks for the reply. We're currently using version 20.1.57 though. Does this automatic conversion behavior only work with Mask enabled?

SP Sureshkumar P Syncfusion Team November 3, 2022 05:32 AM

No, this automatic conversion behavior does not only works with mask enabled. This conversion is working both mask enabled and disabled component behavior.

TN Thien Nguyen November 3, 2022 02:56 PM

I just realized I didn't encounter that behavior because I had strictMode on. Would it be possible to support that behavior even in strictMode?
On a side note, when I was playing around with a datetimepicker controller without strictMode, it accepted lower case pm and am values for the first few times then it stopped - if you keep switch between lower case am and pm for a while the behavior stops working.

SP Sureshkumar P Syncfusion Team November 7, 2022 05:59 AM

When trying the datetimepicker component enter lowercase meridian values after enabling and disabling the strictMode property but cannot replicate the reported issue on our end. find the validated sample in the below link.

Sample link: https://stackblitz.com/edit/react-epcr6y?file=index.js

If still, you have faced the same issue then replicate the reported issue on the above sample and revert us with a detailed issue replication procedure. These details will help us to provide an exact solution as earlier as possible.

TN Thien Nguyen replied to Sureshkumar P November 8, 2022 01:19 PM

Can you give this a try for me on that link?

  1. Select a datetime value by clicking on the calendar or clock icon
  2. Delete the current meridian value and replace it with the other value in lower case (If current value is AM, then type in pm, and vice versa)
  3. Keep repeating step 2
  4. After a while, you should see that the controller stops accepting the lowercase values

SP Sureshkumar P Syncfusion Team November 10, 2022 02:16 AM

Thanks for your shared information. We have confirmed the reported issue is an issue at our end and this fix will be included in our any one of upcoming patch releases,

You can track the status of this issue from the below feedback.

Feedback: https://www.syncfusion.com/feedback/38956

Disclaimer: The inclusion of this solution in the weekly release may change due to other factors including but not limited to QA checks and works reprioritization

Live Chat Icon For mobile
Up arrow icon