How do I add a time picker in a 12hr format with the ability to select AM/PM? | XM Community
Solved

How do I add a time picker in a 12hr format with the ability to select AM/PM?

  • 16 July 2020
  • 3 replies
  • 1414 views

Hi Qualtrics Community,
I was wondering if anyone knows how to add a time picker in the format of a 12hr clock with the ability for the participant to select either AM/PM. I currently have a time picker however, it is in the 24hr clock format. Below are the codes I have used so far and a screenshot of the preview which work but again, I would like it to be in the 12hr clock format with the ability to select either AM/PM.
Header:
https://cdn.jsdelivr.net/npm/flatpickr/dist/flatpickr.min.css"> src="">https://cdn.jsdelivr.net/npm/flatpickr">
JavaScript:
Qualtrics.SurveyEngine.addOnload(function()
{
  jQuery("#"+this.questionId+" .InputText").flatpickr({enableTime: true, noCalendar: true, dateFormat: "H:i"});
});
Screen Shot 2020-07-16 at 4.38.45 PM.pngThanks in advance for the help!

icon

Best answer by rondev 16 July 2020, 23:02

View original

3 replies

Userlevel 7
Badge +22

Change capital H to small 'h', so the code is:

jQuery("#"+this.questionId+" .InputText").flatpickr({enableTime: true, noCalendar: true, dateFormat: "h:i K"});


https://www.qualtrics.com/community/discussion/comment/27952#Comment_27952rondev Thank you!!

Badge

I don't understand why adding a time picker is not in the library. I am non-technical, can someone please provide step-by-step guidance on how I can enter this into my survey to allow me to capture a time. I'm struggling with this. Thanks in advance.

Leave a Reply