/** * Copyright (C) Paul Sarando * Distributed under the Eclipse Public License (http://www.eclipse.org/legal/epl-v10.html). */ declare const GREGORIAN_DAYS_PER_4_YEARS: number; declare const GREGORIAN_DAYS_PER_100_YEARS: number; declare const GREGORIAN_DAYS_PER_400_YEARS: number; declare const GONDOR_DAYS_PER_4_YEARS: number; declare const GONDOR_DAYS_PER_100_YEARS: number; declare const GONDOR_DAYS_PER_1000_YEARS: number; declare const SECOND_AGE_TOTAL_DAYS: number; declare const THIRD_AGE_2059_TOTAL_DAYS: number; declare const THIRD_AGE_2360_TOTAL_DAYS: number; /** * @param {number} year * @return {boolean} True if the given year is a Gregorian leap-year. */ declare const isLeapYear: (year: number) => boolean; /** * @param {Date} fromDate - The starting Date (e.g. first New Year's Day) * @param {Date} toDate - The end Date (e.g. today) * @return {number} The total number of whole days elapsed. */ declare const toDaysElapsed: (fromDate: Date, toDate: Date) => number; /** * @property year - The current year (including 0). * @property daysRemainder - The number of days elapsed since the current New Year's Day. */ interface YearWithRemainder { year: number; daysRemainder: number; } /** * @param {number} daysElapsed - The total number of whole days elapsed since the first New Year Date. * @return {YearWithRemainder} The current Gregorian year for the given `daysElapsed`. */ declare const daysElapsedToGregorianYear: (daysElapsed: number) => YearWithRemainder; /** * @param {Date} today * @param {Date} startDate - The first New Year's Day (e.g. 1/1/1 12:00AM) * @param {number} daysSinceNewYearsDay - The number of whole days elapsed since today's New Year's Day. * @return {Date} The New Year Date for the year of the given `today`. */ declare const getNewYearDate: (startDate: Date, today: Date, daysSinceNewYearsDay: number) => Date; /** * @param {number} daysElapsed - The total number of whole days elapsed since the first New Year Date. * @param {number} daysSinceNewYearsDay - The number of whole days elapsed since the current New Year's Day. * @param {number} daysPerWeek - The number of days in a week. * @return {number} The current day of the week. */ declare const getWeekDay: (daysElapsed: number, daysSinceNewYearsDay: number, daysPerWeek: number) => number; /** * @param {number} daysElapsed - The total number of whole days elapsed since the first New Year Date. * @return {YearWithRemainder} The current Gondor (S.A.) year for the given `daysElapsed`. */ declare const daysElapsedToSecondAgeYear: (daysElapsed: number) => YearWithRemainder; /** * @param {(daysElapsedToGregorianYear|daysElapsedToSecondAgeYear)} getYearWithRemainder * @param {number} daysElapsed - The total number of whole days elapsed since the first New Year Date. * @return {YearWithRemainder} The current Gondor (S.A.) year, with daysRemainder since the current New Reckoning * New Year's Day. */ declare const daysElapsedToNewReckoningYear: (getYearWithRemainder: (daysElapsed: number) => YearWithRemainder, daysElapsed: number) => YearWithRemainder; /** * @param {Date} date1 * @param {Date} date2 * @return {boolean} True if the given dates have the same year, month, and date. */ declare const datesMatch: (date1: Date, date2: Date) => boolean; /** * @param {number} fullYear * @param {number} month * @param {number} day * @return {Date} - A Date at midnight for the given year/month/day. */ declare const fullYearDate: (fullYear: number, month: number, day: number) => Date; /** * * @param today * @returns yesterday - A new Date instance that is 1 day before the given `today`. */ declare const getPrevDate: (today: Date) => Date; /** * @param today * @returns tomorrow - A new Date instance that is 1 day after the given `today`. */ declare const getNextDate: (today: Date) => Date; /** * @property day - The number of the day of the month, if this date is not intercalary; otherwise, the name of the intercalary date. * @property month - The month index. * @property weekDay - The weekday index. * @property gregorian - The corresponding Gregorian date. */ interface CalendarDate { day: number | string; month: number; weekDay: number; gregorian: Date; } /** * @property year - The current year. * @property dates - The dates of this calendar year. * @property today - The given Gregorian Date this calendar year was generated from. */ interface Calendar { year: number; dates: CalendarDate[]; today: Date; } declare const getFirstDate: (calendar: Calendar) => CalendarDate; declare const getLastDate: (calendar: Calendar) => CalendarDate; declare const getFirstDay: (calendar: Calendar) => Date; declare const getLastDay: (calendar: Calendar) => Date; export { GREGORIAN_DAYS_PER_4_YEARS, GREGORIAN_DAYS_PER_100_YEARS, GREGORIAN_DAYS_PER_400_YEARS, GONDOR_DAYS_PER_4_YEARS, GONDOR_DAYS_PER_100_YEARS, GONDOR_DAYS_PER_1000_YEARS, SECOND_AGE_TOTAL_DAYS, THIRD_AGE_2059_TOTAL_DAYS, THIRD_AGE_2360_TOTAL_DAYS, Calendar, CalendarDate, YearWithRemainder, toDaysElapsed, daysElapsedToGregorianYear, daysElapsedToSecondAgeYear, daysElapsedToNewReckoningYear, getNewYearDate, getWeekDay, isLeapYear, datesMatch, fullYearDate, getNextDate, getPrevDate, getFirstDate, getLastDate, getFirstDay, getLastDay, };