Home
GitHub

Time configuration

The time configuration governs the behavior of the time picker. For adjusting the time format between 24-hours or 12-hours, you can modify this setting within the locale configuration.

Here's its structure and types:

export interface DPTimeLimit {
  h: number;
  m: number;
}
 
export interface DPTimeConfig {
  interval: number;
  minTime: DPTimeLimit;
  maxTime: DPTimeLimit;
  useLocales: boolean;
}
export interface DPTimeLimit {
  h: number;
  m: number;
}
 
export interface DPTimeConfig {
  interval: number;
  minTime: DPTimeLimit;
  maxTime: DPTimeLimit;
  useLocales: boolean;
}

interval

The interval property defines the time segments in minutes. It determines the number of values available in a 24-hour day based on the specified interval. For instance, if the interval is set to 30, there will be 48 segments, allowing for 2 segments within each hour.

minTime and maxTime

The minTime and maxTime properties set limits for the time picker:

  • minTime: Disables all times in the prop-getters before the specified minTime.
  • maxTime: Disables all times in the prop-getters after the specified maxTime.

useLocales

The useLocales property, when set to true, utilizes Date.getLocaleTimeString to format time. However, enabling this flag might result in performance issues. Due to reported performance concerns, it has been disabled by default.

While the library provides its own 12-hour converter implementation, enabling the useLocales flag, coupled with locale configuration, allows for accommodating various other specific use cases related to time formatting.