Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

415
Views
Force user to enter only hours in Input=Time and disable Minutes

In my application the Time will always be like HH/00/00. So users will only need to enter the hour value as the minutes will be 00. I could not find a way to change the format of the input=time to only HH.

I found some articles about assigning step value but it doesn't work.

Any idea about preventing users to select minutes and force him to only select hours?

<div class="md-form mx-5 my-5">
    </div>

  <label>Choose your time</label>
  <input type="time"  /

Time

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

How about some JS code ? a simple one really, like the one below, you can add more conditions to make it much more strict, but here you go:

const timeInput = document.getElementById('time');

timeInput.addEventListener('input', (e) => {
  let hour = e.target.value.split(':')[0]
  e.target.value = `${hour}:00`
})
<div class="md-form mx-5 my-5">
    </div>

  <label>Choose your time</label>
  <input id="time" type="time">

about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!