UNPKG

warscript

Version:

A typescript library for Warcraft III using Warpack.

146 lines (145 loc) 5.81 kB
/** @noSelfInFile */ import { DayOfWeek } from "./dayOfWeek"; import { Month } from "./month"; export declare class LocalDate { readonly year: number; readonly month: Month; readonly dayOfMonth: number; private readonly key; private constructor(); static now(): LocalDate; static of(year: number, month: number | Month, day: number): LocalDate; /** * Obtains an instance of {@code LocalDate} from the epoch day count. * <p> * This returns a {@code LocalDate} with the specified epoch-day. * The epoch-day is a simple incrementing count * of days where day 0 is 1970-01-01. Negative numbers represent earlier days. * * @param epochDay the Epoch Day to convert, based on the epoch 1970-01-01 * @return the local date */ private static ofEpochDay; /** * Resolves the date, resolving days past the end of month. * * @param year the year to represent, validated from MIN_YEAR to MAX_YEAR * @param month the month-of-year to represent, validated from 1 to 12 * @param day the day-of-month to represent, validated from 1 to 31 * @return the resolved date */ private static resolvePreviousValid; /** * Gets the day-of-year field. * <p> * This method returns the primitive {@code int} value for the day-of-year. * * @return the day-of-year, from 1 to 365, or 366 in a leap year */ get dayOfYear(): number; /** * Gets the day-of-week field, which is a class {@code DayOfWeek}. * <p> * This method returns the class {@link DayOfWeek} for the day-of-week. * * @return the day-of-week */ get dayOfWeek(): DayOfWeek; /** * Checks if the year is a leap year, according to the ISO proleptic * calendar system rules. * <p> * This method applies the current rules for leap years across the whole time-line. * In general, a year is a leap year if it is divisible by four without * remainder. However, years divisible by 100, are not leap years, with * the exception of years divisible by 400 which are. * <p> * For example, 1904 is a leap year it is divisible by 4. * 1900 was not a leap year as it is divisible by 100, however 2000 was a * leap year as it is divisible by 400. * <p> * The calculation is proleptic - applying the same rules into the far future and far past. * This is historically inaccurate, but is correct for the ISO-8601 standard. * * @return true if the year is leap, false otherwise */ get isLeapYear(): boolean; /** * Returns the length of the month represented by this date. * <p> * This returns the length of the month in days. * For example, a date in January would return 31. * * @return the length of the month in days */ get lengthOfMonth(): number; /** * Returns the length of the year represented by this date. * <p> * This returns the length of the year in days, either 365 or 366. * * @return 366 if the year is leap, 365 otherwise */ get lengthOfYear(): number; /** * Returns a copy of this {@code LocalDate} with the specified number of months added. * <p> * This method adds the specified amount to the months field in three steps: * <ol> * <li>Add the input months to the month-of-year field</li> * <li>Check if the resulting date would be invalid</li> * <li>Adjust the day-of-month to the last valid day if necessary</li> * </ol> * <p> * For example, 2007-03-31 plus one month would result in the invalid date * 2007-04-31. Instead of returning an invalid result, the last valid day * of the month, 2007-04-30, is selected instead. * <p> * This instance is immutable and unaffected by this method call. * * @param monthsToAdd the months to add, may be negative * @return a {@code LocalDate} based on this date with the months added, not null */ plusMonths(monthsToAdd: number): LocalDate; /** * Returns a copy of this {@code LocalDate} with the specified number of weeks added. * <p> * This method adds the specified amount in weeks to the days field incrementing * the month and year fields as necessary to ensure the result remains valid. * The result is only invalid if the maximum/minimum year is exceeded. * <p> * For example, 2008-12-31 plus one week would result in 2009-01-07. * <p> * This instance is immutable and unaffected by this method call. * * @param weeksToAdd the weeks to add, may be negative * @return a {@code LocalDate} based on this date with the weeks added */ plusWeeks(weeksToAdd: number): LocalDate; /** * Returns a copy of this {@code LocalDate} with the specified number of days added. * <p> * This method adds the specified amount to the days field incrementing the * month and year fields as necessary to ensure the result remains valid. * The result is only invalid if the maximum/minimum year is exceeded. * <p> * For example, 2008-12-31 plus one day would result in 2009-01-01. * <p> * This instance is immutable and unaffected by this method call. * * @param daysToAdd the days to add, may be negative * @return a {@code LocalDate} based on this date with the days added */ plusDays(daysToAdd: number): LocalDate; private toEpochDay; /** * Outputs this date as a {@code String}, such as {@code 2007-12-03}. * <p> * The output will be in the ISO-8601 format {@code uuuu-MM-dd}. * * @return a string representation of this date */ toString(): string; private __lt; private __le; }