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

179
Views
Regular expression for dynamic replacement of the entered time

Please help me make a regular expression (JS) with the following conditions

  • enter a number in the field <= 24
  • you can enter the decimal part separated by a dot (14.6, 3.4, 1, 3)
  • the number must be rounded to one decimal place (23.45 -> 23.4, 1.42 -> 1.4, 1.27 -> 1.3)
  • if the entered number is greater than 24, the number is replaced by the maximum (24)
  • if the number is entered incorrectly, it is immediately replaced by correct

Here is my attempt to do something

/(^\d|1\d|2[0-4]|(^\d|1\d|2[0-3])\.\d)$/gm;
about 4 years ago · Juan Pablo Isaza
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!