Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

timezone-picker-svelte

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

timezone-picker-svelte

Timezone picker for Svelte

  • 1.0.2
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

Updated/Extended version of svelte-timezone-picker

Timezone Picker Svelte

You need a timezone picker that will allow the user to pick a timezone from a list. You want it to be accessible and follow the ARIA design pattern for a select.

This is a component that controls all user interactions and state for you. It follows best practices and accessibility guidelines.

The timezones are all valid IANA time zones.

Installation

License NPM Downloads

This module is distributed via npm which is bundled with node and should be installed as one of your project's dependencies:

yarn add timezone-picker-svelte
npm i timezone-picker-svelte

If you are going to use the svelte component, make sure you have svelte installed as well.

Usage

Svelte component

To use it in your Svelte app, simply import it as a component.

<script>
	import TimezonePicker from 'timezone-picker-svelte'

	let timezone = 'Europe/London'

	function update(ev) {
		console.log(ev.detail.timezone)
	}
</script>

<TimezonePicker {timezone} on:update="{update}" />

Props

PropertyTypeRequired?DescriptionDefault
timezoneStringThe current timezone. Must be a valid timezone from IANA.Intl.DateTimeFormat().resolvedOptions().timeZone
expandedBooleanWhether the dropdown should be automatically expanded or not.false
allowedTimezonesArrayControl which timezones display in the list. Must be a valid timezone from IANA.null

Events

NameDescriptionReturn
updateDispatched every time you change the timezone.An object with the selected timezone.

Styling

You can use CSS variables to style the DOM elements of timezone-picker.

:root {
	--color-white: #fff;
	--color-info-900: #076196;
	--color-gray-100: rgba(0, 0, 0, 0.2);
	--color-gray-400: #acacac;
	--color-gray-600: #757575;
	--color-gray-900: #292929;
}

License

MIT License - fork, modify and use however you want.

FAQs

Package last updated on 19 May 2024

Did you know?

Socket

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
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc