"use client"; import * as React from "react"; import { cn } from "@/lib/utils"; import { Button } from "@/components/ui/button"; import { HiOutlineGlobeAlt, HiChevronDown, HiCheck } from "react-icons/hi2"; import { Command, CommandEmpty, CommandGroup, CommandInput, CommandItem, } from "@/components/ui/command"; import { Popover, PopoverContent, PopoverTrigger, } from "@/components/ui/popover"; import { TIMEZONES } from "@/constants/timezones"; const timezones = TIMEZONES.filter((t) => Intl.supportedValuesOf("timeZone").includes(t.name), ).map((t) => ({ label: `(${t.offset}) ${t.name.split("/").pop()?.replaceAll("_", " ")}`, value: t.name, })); type TimezoneSelectorProps = { value: string; onChange: (val: string) => void; className?: string; hideIcon?: boolean; }; export function TimezoneSelector({ value, onChange, className, hideIcon = false, }: TimezoneSelectorProps) { const [open, setOpen] = React.useState(false); return ( No timezone found. {timezones.map((timezone) => ( { onChange(timezone.value); setOpen(false); }} > {timezone.label} ))} ); }