UNPKG

nhb-toolbox

Version:

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

32 lines 1.41 kB
import type { Numeric } from '../types/index'; import type { ClockTime, UTCOffSet } from './types'; /** * * Checks if the provided value is a valid time string in "HH:MM" format. * * @param value - The value to check. * @returns `true` if the value is a valid time string, `false` otherwise. */ export declare function isValidTime(value: unknown): value is ClockTime; /** * * Checks if the provided value is a valid UTCOffSet (e.g. `UTC-01:30`). * * @param value - The value to check. * @returns `true` if the value is a valid utc offset, `false` otherwise. */ export declare function isValidUTCOffSet(value: unknown): value is UTCOffSet; /** * * Checks if the year is a leap year. * * - A year is a leap year if it is divisible by 4, but not divisible by 100, unless it is also divisible by 400. * - For example, 2000 and 2400 are leap years, but 1900 and 2100 are not. * @param year The year to check. * @returns `true` if the year is a leap year, `false` otherwise. */ export declare function isLeapYear(year: Numeric): boolean; /** * * Checks if a value is a date-like object from `Date`, `Chronos`, `Moment.js`, `Day.js`, `Luxon`, `JS-Joda`, or `Temporal` * @param value Value to check if it is date-like object. * @returns `true` if the value is date-like object, otherwise `false`. */ export declare function isDateLike(value: unknown): boolean; //# sourceMappingURL=guards.d.ts.map