import { type Maybe } from '../value/maybe.type'; import { type Hours, type Minutes } from './date'; /** * A number that represents hours and rounded to the nearest minute. * * It has only three decimal places max. * * Fractional hours are safe to add together. * * For example: * * - 10 minutes: 0.16 * - 15 minutes : 0.25 */ export type FractionalHour = number; /** * Precision function that rounds fractional hour values to 3 decimal places. */ export declare const FRACTIONAL_HOURS_PRECISION_FUNCTION: import("..").CutValueToPrecisionFunction; /** * Converts the number of minutes to a fractional hour. * * Minutes are rounded down before conversion. * * @param minutes - Number of minutes to convert * @returns The equivalent fractional hour value */ export declare function minutesToFractionalHours(minutes: Minutes): FractionalHour; /** * Converts a fractional hour value to the equivalent number of minutes. * * @param hours - Fractional hour value to convert * @returns The equivalent number of minutes (rounded) */ export declare function fractionalHoursToMinutes(hours: FractionalHour): Minutes; /** * Rounds the input hour to the nearest FractionalHour precision (3 decimal places). * * @param hour - The hour value to round * @returns The rounded fractional hour */ export declare function hourToFractionalHour(hour: Hours): FractionalHour; /** * Input for computing the next fractional hour by adding minutes and/or hours. */ export interface ComputeFractionalHour { readonly minutes?: Maybe; readonly hours?: Maybe; } /** * Computes the next fractional hour by adding the specified hours and minutes to the input value. * * @param input - The starting fractional hour value * @param change - The hours and/or minutes to add * @returns The resulting fractional hour */ export declare function computeNextFractionalHour(input: FractionalHour, change: ComputeFractionalHour): FractionalHour; /** * The minute of the day. * * Number from 0-1439. */ export type MinuteOfDay = number; export declare const MINUTE_OF_DAY_MINIUMUM = 0; export declare const MINUTE_OF_DAY_MAXMIMUM: number; /** * Returns true if the input value is a valid MinuteOfDay (0-1439). * * @param input - The number to validate * @returns True if the input is within the valid MinuteOfDay range */ export declare function isMinuteOfDay(input: number): input is MinuteOfDay; /** * A pair of hours and minutes. */ export interface HoursAndMinutes { readonly hour: number; readonly minute: number; } /** * Converts the input number of minutes to the equivalent in hours and minutes. * * @param inputMinutes - Total minutes to convert * @returns An object with the hour and minute components */ export declare function minutesToHoursAndMinutes(inputMinutes: Minutes): HoursAndMinutes; /** * Reads the hour and minutes of the Date in the local timezone. * * @param date - The date to extract hours and minutes from * @returns An object with the hour and minute components */ export declare function dateToHoursAndMinutes(date: Date): HoursAndMinutes; /** * Converts the input hours and minutes to a MinuteOfDay. * * @param hour - The hour component (0-23) * @param minute - The minute component (0-59) * @returns The corresponding MinuteOfDay value */ export declare function toMinuteOfDay(hour: Hours, minute: Minutes): MinuteOfDay; /** * Creates a new date with the time set to the given minute of the day. * * @param minuteOfDay - The minute of the day (0-1439) * @param day - Optional base date to use (defaults to the current date) * @returns A Date with the time set to the specified minute of day */ export declare function dateFromMinuteOfDay(minuteOfDay: Minutes | MinuteOfDay, day?: Date): Date; /** * Converts a Date to a MinuteOfDay based on the local timezone. * * @param date - The date to convert * @returns The MinuteOfDay for the given date */ export declare function dateToMinuteOfDay(date: Date): MinuteOfDay; /** * Converts the input minutes to a valid MinuteOfDay by wrapping around the day boundary. * * @param minutes - The minutes value to convert * @returns A MinuteOfDay value (0-1439) */ export declare function asMinuteOfDay(minutes: Minutes): MinuteOfDay; /** * Returns a human-readable string that represents the input hours and minutes. * * Examples: * - {} -> '' * - { hour: 1, minute: 30 } -> "1 hours and 30 minutes" * - { hour: 1 } -> "1 hours" * - { minute: 30 } -> "30 minutes" * * @param input - The hours and minutes to format * @returns A human-readable string representation */ export declare function hoursAndMinutesToString(input: HoursAndMinutes): string;