HosseinShabani / react-native-modern-datepicker

A customizable calendar, time & month picker for React Native (including Persian Jalaali calendar & locale)
MIT License
573 stars 159 forks source link

24-Hour and Time Range Support #142

Open sarmiSiva opened 9 months ago

sarmiSiva commented 9 months ago

I'd like to request the addition of two essential features to the react-native-modern-datepicker library to enhance its flexibility and usability: Time Format (12-Hour or 24-Hour): Currently, the library supports date selection efficiently, but it lacks the ability to toggle between 12-hour and 24-hour time formats for time selection. This feature would allow users to choose their preferred time format based on their regional preferences or application requirements.

Minimum and Maximum Time Range: Additionally, it would be immensely beneficial to have the capability to set a minimum and maximum time range for selection. This feature would enable developers to restrict time selections to a specific range, ensuring that users can only pick times within predefined boundaries. This can be useful for applications such as appointment scheduling, where certain time slots need to be enforced.

Feature Details:

Time Format:

Description: The ability to set the time format to either 12-hour (AM/PM) or 24-hour (HH:mm) should be introduced. Implementation Proposal: A new prop, say timeFormat, could be added to the datepicker component. This prop could accept values like "12h" or "24h," where "12h" indicates the use of the 12-hour format, and "24h" indicates the use of the 24-hour format.

Minimum and Maximum Time Range:

Description: The library should support the specification of a minimum and maximum time range, so users can only select times within that range. Implementation Proposal: Two new props, perhaps minTime and maxTime, could be introduced. These props would accept time values in the chosen time format (either 12-hour or 24-hour).