Security News
RubyGems.org Adds New Maintainer Role
RubyGems.org has added a new "maintainer" role that allows for publishing new versions of gems. This new permission type is aimed at improving security for gem owners and the service overall.
rc-time-picker
Advanced tools
The rc-time-picker package is a React component for selecting time. It provides a simple and customizable time picker component that can be easily integrated into React applications.
Basic Time Picker
This feature allows you to add a basic time picker to your React application. The component is imported and used directly in the JSX.
import React from 'react';
import TimePicker from 'rc-time-picker';
import 'rc-time-picker/assets/index.css';
const App = () => (
<TimePicker />
);
export default App;
Time Picker with Default Value
This feature allows you to set a default time value for the time picker. The default value is set using the moment.js library.
import React from 'react';
import TimePicker from 'rc-time-picker';
import moment from 'moment';
import 'rc-time-picker/assets/index.css';
const App = () => (
<TimePicker defaultValue={moment('12:08', 'HH:mm')} />
);
export default App;
Time Picker with 12-Hour Format
This feature allows you to configure the time picker to use a 12-hour format instead of the default 24-hour format.
import React from 'react';
import TimePicker from 'rc-time-picker';
import 'rc-time-picker/assets/index.css';
const App = () => (
<TimePicker use12Hours />
);
export default App;
Time Picker with Disabled Hours
This feature allows you to disable specific hours in the time picker. In this example, the hours from 0 to 6 are disabled.
import React from 'react';
import TimePicker from 'rc-time-picker';
import 'rc-time-picker/assets/index.css';
const App = () => (
<TimePicker disabledHours={() => [0, 1, 2, 3, 4, 5, 6]} />
);
export default App;
The react-time-picker package is another React component for selecting time. It offers a similar set of features to rc-time-picker but with a different API and styling options. It is known for its ease of use and integration with React applications.
The react-datepicker package is a comprehensive date and time picker component for React. It provides a wide range of features including date selection, time selection, and date-time range selection. It is more feature-rich compared to rc-time-picker but also more complex to integrate.
The react-datetime package is a versatile date and time picker component for React. It combines both date and time selection in a single component and offers extensive customization options. It is a good alternative to rc-time-picker for applications that require both date and time selection.
React TimePicker
http://react-component.github.io/time-picker/
npm install rc-time-picker
import TimePicker from 'rc-time-picker';
import ReactDOM from 'react-dom';
import 'rc-time-picker/assets/index.css';
ReactDOM.render(<TimePicker />, container);
Name | Type | Default | Description |
---|---|---|---|
prefixCls | String | 'rc-time-picker' | prefixCls of this component |
clearText | String | 'clear' | clear tooltip of icon |
disabled | Boolean | false | whether picker is disabled |
allowEmpty | Boolean | true | allow clearing text |
open | Boolean | false | current open state of picker. controlled prop |
defaultValue | moment | null | default initial value |
defaultOpenValue | moment | moment() | default open panel value, used to set utcOffset,locale if value/defaultValue absent |
value | moment | null | current value |
placeholder | String | '' | time input's placeholder |
className | String | '' | time picker className |
id | String | '' | time picker id |
popupClassName | String | '' | time panel className |
popupStyle | object | {} | customize popup style |
showHour | Boolean | true | whether show hour |
showMinute | Boolean | true | whether show minute |
showSecond | Boolean | true | whether show second |
format | String | - | moment format |
disabledHours | Function | - | disabled hour options |
disabledMinutes | Function | - | disabled minute options |
disabledSeconds | Function | - | disabled second options |
use12Hours | Boolean | false | 12 hours display mode |
hideDisabledOptions | Boolean | false | whether hide disabled options |
onChange | Function | null | called when select a different value |
onAmPmChange | Function | null | called when select an am/pm value |
addon | Function | - | called from timepicker panel to render some addon to its bottom, like an OK button. Receives panel instance as parameter, to be able to close it like panel.close() . |
placement | String | bottomLeft | one of ['topLeft', 'topRight', 'bottomLeft', 'bottomRight'] |
transitionName | String | '' | |
name | String | - | sets the name of the generated input |
onOpen | Function({ open }) | when TimePicker panel is opened | |
onClose | Function({ open }) | when TimePicker panel is closed | |
hourStep | Number | 1 | interval between hours in picker |
minuteStep | Number | 1 | interval between minutes in picker |
secondStep | Number | 1 | interval between seconds in picker |
focusOnOpen | Boolean | false | automatically focus the input when the picker opens |
inputReadOnly | Boolean | false | set input to read only |
inputIcon | ReactNode | specific the select icon. | |
clearIcon | ReactNode | specific the clear icon. |
npm test
npm run chrome-test
npm run coverage
open coverage/ dir
rc-time-picker is released under the MIT license.
FAQs
React TimePicker
The npm package rc-time-picker receives a total of 61,807 weekly downloads. As such, rc-time-picker popularity was classified as popular.
We found that rc-time-picker demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 7 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
RubyGems.org has added a new "maintainer" role that allows for publishing new versions of gems. This new permission type is aimed at improving security for gem owners and the service overall.
Security News
Node.js will be enforcing stricter semver-major PR policies a month before major releases to enhance stability and ensure reliable release candidates.
Security News
Research
Socket's threat research team has detected five malicious npm packages targeting Roblox developers, deploying malware to steal credentials and personal data.