UNPKG

made-data-converters

Version:
41 lines (40 loc) 1.77 kB
/** * Gets the current age in years based on the specified starting date and today's date. * @param {Date} startingDate - The starting date. * @return {number} A numeric value representing the age in years. */ export declare function toCurrentAge(startingDate: Date): number; /** * Gets the day suffix for the specified date, i.e. st, nd, rd, or th. * @param {Date} date - The date to get a day suffix for. * @return {string} The day suffix as a string. */ export declare function toDaySuffix(date: Date): string; /** * Rounds the date value to its nearest hour determined by the half hour of each hour. * @param {Date} date - The date to round to the nearest hour. * @return {Date} The date rounded to the nearest whole hour. */ export declare function toNearestHour(date: Date): Date; /** * Gets the start of the day represented by the specified date. * @param {Date} date - The date. * @return {Date} A new date with the same date with the time set to midnight. */ export declare function startOfDay(date: Date): Date; /** * Gets the end of the day represented by the specified date. * @param {Date} date - The date. * @return {Date} A new date with the same date with the time set to just before midnight of the next day. */ export declare function endOfDay(date: Date): Date; /** * Sets the time value of a date. * @param {Date} date - The date value to set the time of. * @param {number} hours - The hours to set. * @param {number} minutes - The minutes to set. * @param {number} seconds - The seconds to set. * @param {number} milliseconds - The milliseconds to set. * @return {Date} A new date with the time set. */ export declare function setTime(date: Date, hours: number, minutes: number, seconds: number, milliseconds: number): Date;