Security News
Input Validation Vulnerabilities Dominate MITRE's 2024 CWE Top 25 List
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
react-timezone-select
Advanced tools
Another react timezone select component, I know.. However this one has a few key benefits!
While looking around for a good option, I had trouble finding a timezone select components which:
1) Adjusted the choices automatically with Daylight Savings Time (DST)
2) Didn't have a huge list of choices to scroll through when technically only 24 (ish) are necessary
Update: v0.7+ now built with
spacetime
instead ofmoment.js
, reducing bundle size by ~66%!
npm install --save-prod react-timezone-select
import React, { useState } from 'react'
import ReactDOM from 'react-dom'
import TimezoneSelect from 'react-timezone-select'
const App = () => {
const [selectedTimezone, setSelectedTimezone] = useState({})
return (
<div className='App'>
<h2>react-timezone-select</h2>
<blockquote>Please make a selection</blockquote>
<div className='select-wrapper'>
<TimezoneSelect
value={selectedTimezone}
onChange={tz => setSelectedTimezone(tz)}
/>
</div>
<h3>Output:</h3>
<div className='code'>
<span style={{ fontWeight: '500' }}>selectedTimezone: {'{'}</span>{' '}
<br />
<span style={{ marginLeft: '20px', fontWeight: '500' }}>
value: '{selectedTimezone.value}'
</span>
<br />
<span style={{ marginLeft: '20px', fontWeight: '500' }}>
label: '{selectedTimezone.label}'
</span>
<br />
{'}'}
</div>
</div>
)
}
const rootElement = document.getElementById('root')
ReactDOM.render(<App />, rootElement)
value
- { value: string, label: string }
onBlur
- () => void
onChange
- (timezone) => void
react-select
props, className, etc. - we pass it all on down now.Theres a small example page / implementation available in the ./examples
directory, simply run npm start
after installing everything and webpack dev server should begin, where you will be able to find the demo at localhost:3001
Pull requests are always welcome!
FAQs
Usable, dynamic React Timezone Select
The npm package react-timezone-select receives a total of 47,018 weekly downloads. As such, react-timezone-select popularity was classified as popular.
We found that react-timezone-select 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.
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.
Research
Security News
A threat actor's playbook for exploiting the npm ecosystem was exposed on the dark web, detailing how to build a blockchain-powered botnet.