Research
Security News
Malicious npm Packages Inject SSH Backdoors via Typosquatted Libraries
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
react-time-picker
Advanced tools
A carefully crafted time picker for React
$ npm install react-time-picker --save
See time picker demo
var TimePicker = require('./src')
var VALUE = '14:00:01'
var onChange = function(value){
picker.setProps({value: value})
}
var picker = React.render(
<TimePicker
value={VALUE}
onChange={onChange}
/>,
document.getElementById('content')
)
For uncontrolled behavior, use defaultValue
instead of value
The time picker can also be used on touch devices.
The time picker can display time in multiple formats. For example, you can show hour, hour & minute, hour & minute & second, and all of these with or without AM/PM.
You can specify a format to decide which parts of the time picker to display
format: String - a format that dictates which parts of the time picker are displayed. Valid parts are:
So you can decide what to display either by specifying a format
or just use the appropriate formatting on the value
you provide.
By default when minutes/seconds are incremented, and they overflow 59, the next amount is increased. You can also overflow hour to trigger a meridian change by using overflowHourToMeridian
.
When time arrows are triggered, values are incremented with a certain amount - called step. The default step
value is 1
step
will be used when incrementing the hourstep
will be used when incrementing the minutestep
will be used when incrementing the secondThe time picker comes with built-in styles, no dependencies on external css files.
By default, the timepicker is 200px in width and has padding 10px. You can easily change that:
<TimePicker style={{width: '100%', padding: 5}} />
Styles for time boxes (the div containing the input and the arrows)
Styles for time input fields
useArrowKeys: Boolean - defaults to true. When this prop is true
, you can update time values with arrow up/down keys when field is focused. Set to false
if you don't want this behavior
inputFactory: Function(props) - you can control how to render the time inputs, by using this function. It will be called with some props for the input:
Changing either onChange
, onFocus
or onBlur
of the props passed in to inputFactory
is not recommended. If you choose to change those, make sure you know what you're doing or you call the initial functions along with your own logic
showArrows: Boolean - decides whether to show arrows or not. Defaults to true
arrowStyle - style to be applied to all arrows
arrowUpStyle
arrowDownStyle
arrowOverStyle
arrowUpOverStyle
arrowDownOverStyle
arrowFactory
stepDelay: Number - defaults to 60. The amount of milliseconds between amount increments when mouse is down on an arrow
stopChangePropagation: Boolean - defaults to true. Stops the propagation of the change
event on the inputs contained in the time picker. Needed so your onChange
function will not get called multiple times, and with different arguments. Only modify this if you know what you're doing
normalizeStyle: Boolean - defaults to true. Uses react-style-normalizer to prefix style names when needed. In this case, all style props are prefixed (style, inputStyle, hourStyle, etc... )
Check out the project, cd into it and do
$ npm install
$ npm run dev # to run webpack-dev-server
$ npm run serve # to run a web server to serve your files
Navigate to localhost:9091.
Change the sources in the src
directory. When a change is detected, the browser is auto refreshed.
To make a new build, execute npm run build
, which refreshes the lib
folder (for use with npm) from sources found in src
, and also creates a concatenated file for use in the browser (minified version as well).
See Roadmap
See Changelog
MIT
FAQs
A time picker for your React app.
The npm package react-time-picker receives a total of 86,483 weekly downloads. As such, react-time-picker popularity was classified as popular.
We found that react-time-picker demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer 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.
Research
Security News
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
Security News
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
Security News
In this segment of the Risky Business podcast, Feross Aboukhadijeh and Patrick Gray discuss the challenges of tracking malware discovered in open source softare.