Dogfalo / materialize

Materialize, a CSS Framework based on Material Design
https://materializecss.com
MIT License
38.86k stars 4.74k forks source link

component:timepicker Need greater control on minutes selection in Timepicker #5923

Open daanishrumani opened 6 years ago

daanishrumani commented 6 years ago

The need is to show minutes in increments of 15 or 30 in the time picker. This could be driven by an option that takes a multiple of 5.

Possible Solution

js/timepicker.js
24a25
>     minutesTick: 5, // a tick every x minutes (x is a multiple of 5). default = 5 mins
375a377,381
>       let $minutesTick =
>         this.options.minutesTick % 5 == 0
>           ? this.options.minutesTick
>           : 5;
>       
377c383
<       for (let i = 0; i < 60; i += 5) {
---
>       for (let i = 0; i < 60; i += $minutesTick) {

Steps to Reproduce (for bugs)

  1. Use a timepicker.
  2. Select time hours
  3. The minutes selection shows a tick every 5 minutes.

Context

We want to show a timepicker with 15 mins or 30 mins steps only. The 5 min step is a clutter when I want to select only in multiples of 15 mins or 30 mins. My client is a cake shop owner and he doesn't need 5 minute precision. He can't deliver in 5 minute precision and therefore wants to prevent the users of his website to select times with 5 minute increments.

Your Environment

pirex360 commented 4 years ago

Any output ? i need to restrict interval of minutes to 15.... any results ?

pirex360 commented 4 years ago

Your solution only draws the minute clock to show interval minutes...its possible to select 12:01 per example. minutesTick: 15, show 0 15 30 45 minutes