nhb-toolbox
Version:
A versatile collection of smart, efficient, and reusable utility functions, classes and types for everyday development needs.
38 lines (37 loc) • 2.27 kB
TypeScript
import type { $Chronos, ZodiacMeta, ZodiacMetaOptions, ZodiacOptions, ZodiacSign } from '../types';
declare module '../Chronos' {
interface Chronos {
/**
* @instance Returns the zodiac sign based on current date or `birthDate` option.
* @param options Optional config to choose preset or provide custom zodiac date ranges.
* @returns The matching zodiac sign from preset/custom list.
*/
getZodiacSign<Sign extends string = ZodiacSign>(options?: ZodiacOptions<Sign>): Sign;
/**
* @instance Returns the zodiac sign based on current date or `birthDate` option.
* @remarks This method is an alias for {@link https://toolbox.nazmul-nhb.dev/docs/classes/Chronos/names#getzodiacsign getZodiacSign} method.
*
* @param options Optional config to choose preset or provide custom zodiac date ranges.
* @returns The matching zodiac sign from preset/custom list.
*/
zodiac<Sign extends string = ZodiacSign>(options?: ZodiacOptions<Sign>): Sign;
/**
* @instance Returns detailed metadata for a given zodiac sign based on the selected `preset` or custom ranges.
*
* @remarks
* - The metadata includes the sign's `index` within the normalized zodiac order, its inclusive start and end dates.
* - **Note:** The returned `index` represents the chronological position of the zodiac sign based on Gregorian month–day ordering and may vary between different zodiac variants.
* - Handles year-boundary wrapping correctly (e.g. Capricorn, Sagittarius).
*
* @param sign The zodiac sign to retrieve metadata for.
* @param options Optional configuration to select a zodiac preset or provide custom ranges.
*
* @throws A {@link RangeError} if the provided sign does not exist in the resolved zodiac set.
*
* @returns A metadata object describing the zodiac sign's position and date range.
*/
getZodiacMeta<Sign extends string = ZodiacSign>(sign: Sign, options?: ZodiacMetaOptions<Sign>): ZodiacMeta<Sign>;
}
}
/** * Plugin to inject `zodiac` related methods */
export declare const zodiacPlugin: ($Chronos: $Chronos) => void;