UNPKG

nhb-toolbox

Version:

A versatile collection of smart, efficient, and reusable utility functions and classes for everyday development needs.

28 lines 1.6 kB
import type { TimeZone, UTCOffSet } from '../types'; type ChronosConstructor = import('../Chronos').Chronos; type MainChronos = typeof import('../Chronos').Chronos; declare module '../Chronos' { interface Chronos { /** * @instance Create a new instance of `Chronos` in the specified timezone. * * @param zone - Standard timezone abbreviation (e.g., 'IST', 'UTC', 'EST') or UTC Offset in `UTC-01:30` format. * @returns A new instance of `Chronos` with time in the given timezone. Invalid input sets time-zone to `UTC`. */ timeZone(zone: TimeZone | UTCOffSet): ChronosConstructor; /** * @instance Returns the current time zone abbreviation (e.g. `"BST"` for `Bangladesh Standard Time`). * @param utc Optional UTC offset in `"UTC+06:00"` format. When passed, it bypasses the current time zone offset. * @returns Time zone name in full descriptive string or UTC offset if it is not a valid time zone. * @remarks * - This method uses a predefined mapping of UTC offsets to abbreviated time zone codes. * - If multiple time zones share the same UTC offset, it returns the **first abbreviation** from the list. * - If no match is found (which is rare), it returns the UTC offset (e.g. `"UTC+06:00"`). */ getTimeZoneNameShort(utc?: UTCOffSet): TimeZone | UTCOffSet; } } /** * Plugin to inject `timeZone` related methods */ export declare const timeZonePlugin: (ChronosClass: MainChronos) => void; export {}; //# sourceMappingURL=timeZonePlugin.d.ts.map