Add Current Time to Gravity Forms Time Field

It’s unfortunate that the Time Field in Gravity Forms does not have more custom options available.

Contrarily, the Date Field, allows for a calendar icon, and drop downs, but the Time Field doesn’t have a default placeholder option to populate the current time, or an alternate view to allow for drop downs showing 12 or 24 hour time.

So I had to turn to jQuery…

24-Hour Format:

var dt = new Date();
jQuery("#input_4_66_1").val(dt.getHours()); // input ID of Hours field
jQuery("#input_4_66_2").val(dt.getMinutes()); // inputer ID of Minutes field

12-Hour Format:

var time = new Date();
hours = time.getHours() % 12 || 12; 
minutes = time.toLocaleString('en-US', { minute:'numeric', hour12: true });

Sourced here.

2 thoughts on “Add Current Time to Gravity Forms Time Field

Leave a Reply

katherine as a flat graphic icon

About Me

I’m an African / Ojibwe First Nations Web Developer living in Winnipeg, Manitoba.

Visit the Tips and Blog to see what I’m working on.

%d bloggers like this: