DEV Community

Cover image for The Next Level Time Picker For Your Next React App ⌚️
MEddarhri
MEddarhri

Posted on

The Next Level Time Picker For Your Next React App ⌚️

React Ios Time Picker

A modern way to pick time

npm npm

demo

Install

npm install react-ios-time-picker
Enter fullscreen mode Exit fullscreen mode

Usage

24 hours format usage

24hours-format

import React, { useState } from 'react';
import { TimePicker } from 'react-ios-time-picker';

export default const  MyApp = () => {
   const [value, setValue] = useState('10:00');

   const onChange = (timeValue) => {
      setValue(timeValue);
   }

   return (
      <div>
         <TimePicker onChange={onChange} value={value} />
      </div>
   );
}
Enter fullscreen mode Exit fullscreen mode

12 hours format usage

12hours-format

import React, { useState } from 'react';
import { TimePicker } from 'react-ios-time-picker';

export default const  MyApp = () => {
   const [value, setValue] = useState('10:00 AM');

   const onChange = (timeValue) => {
      setValue(timeValue);
   }

   return (
      <div>
         <TimePicker onChange={onChange} value={value} use12Hours/>
      </div>
   );
}
Enter fullscreen mode Exit fullscreen mode

Contributions Welcome!

git clone https://github.com/MEddarhri/react-ios-time-picker
cd react-ios-time-picker

Enter fullscreen mode Exit fullscreen mode

Issues

If you have any questions, suggestions for enhancements, or if you find any bugs, please raise them on the repo:
https://github.com/MEddarhri/react-ios-time-picker/issues

Top comments (2)

Collapse
 
abdalhafez profile image
abdalhafez1997

12 hours format usage not work return error => TypeError: Cannot read properties of undefined (reading 'translatedValue')

Image description

Collapse
 
abdalhafez profile image
abdalhafez1997

12 hours format usage
not work return error => TypeError: Cannot read properties of undefined (reading 'translatedValue')