@neo4j-ndl/react
Version:
React implementation of Neo4j Design System
61 lines • 2.58 kB
TypeScript
/**
*
* Copyright (c) "Neo4j"
* Neo4j Sweden AB [http://neo4j.com]
*
* This file is part of Neo4j.
*
* Neo4j is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
export interface TimeZoneOption {
value: string;
label: string;
offset: string;
offsetMinutes: number;
}
/**
* Generates UTC-only timezone options derived from the Intl API
* Uses the Intl API to discover which UTC offsets are actually used by supported timezones
* @param referenceDate - The date to use for calculating timezone offsets (defaults to current date)
*/
export declare const generateUTCTimeZoneOptions: (referenceDate?: Date) => TimeZoneOption[];
/**
* Generates a list of common timezone options with their UTC offsets
* @param referenceDate - The date to use for calculating timezone offsets (defaults to current date)
* @param excludeUTC - Whether to exclude the UTC timezone from the list (useful when combining with UTC-only options)
*/
export declare const generateTimeZoneOptions: (referenceDate?: Date, excludeUTC?: boolean) => TimeZoneOption[];
/**
* Gets the user's current timezone
*/
export declare const getUserTimeZone: () => string;
/**
* Parses a custom UTC offset string (e.g., "UTC+5:30", "UTC-3:45")
* @param input - The input string to parse
* @returns The parsed timezone value or null if invalid
*/
export declare const parseCustomUTCOffset: (input: string) => string | null;
/**
* Validates if a string is a valid UTC timezone format
* @param input - The input string to validate
* @returns True if valid UTC timezone format
*/
export declare const isValidUTCFormat: (input: string) => boolean;
/**
* Formats a timezone for display
* @param timezone - The IANA timezone identifier or UTC offset
* @param referenceDate - The date to use for calculating the offset (defaults to current date)
*/
export declare const formatTimeZone: (timezone: string, referenceDate?: Date) => string;
//# sourceMappingURL=generate-timezone-options.d.ts.map