Socket
Socket
Sign inDemoInstall

timezone-list-hook

Package Overview
Dependencies
7
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    timezone-list-hook

Usable, dynamic timezone list that exports a useTimezoneSelect hook


Version published
Weekly downloads
1
decreased by-66.67%
Maintainers
1
Created
Weekly downloads
 

Readme

Source

timezone-list-hook

This is a fork of ndom91/react-timezone-select with the following changes:

  • Removed react-select dependency
  • Exported only useTimezoneSelect and allTimezones

🪝 Hooks

import { useTimezoneSelect, allTimezones } from 'timezone-list-hook'

const labelStyle = 'original'
const timezones = {
  ...allTimezones,
  'Europe/Berlin': 'Frankfurt',
}

const customSelect = () => {
  const { options, parseTimezone } = useTimezoneSelect({
    labelStyle,
    timezones,
  })

  return (
    <select onChange={(e) => onChange(parseTimezone(e.currentTarget.value))}>
      {options.map((option) => (
        <option value={option.value}>{option.label}</option>
      ))}
    </select>
  )
}

OR

You can use the useTimezoneSelect hook to build your own custom timezone select component.

🚧 Contributing

Pull requests are always welcome! Please stick to repo settings (prettier, eslint, etc.), and if adding new features, please consider adding test(s) and documentation where appropriate!

Keywords

FAQs

Last updated on 13 Jan 2024

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.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc