spreadsheet
typeScript/javascript spreadsheet parser, with formulas.
git clone https://git.vogt.world/spreadsheet.git
Log | Files | README.md
← All files
name: dist/Formulas/Date.d.ts
-rw-r--r--
15520
  1/// <reference path="../../node_modules/moment/moment.d.ts" />
  2/**
  3 * Converts a provided year, month, and day into a date.
  4 * @param year - The year component of the date.
  5 * @param month - The month component of the date.
  6 * @param day - The day component of the date.
  7 * @returns {number} newly created date.
  8 * @constructor
  9 */
 10declare let DATE: (year: any, month: any, day: any) => number;
 11/**
 12 * Converts a provided date string in a known format to a date value.
 13 * @param dateString - The string representing the date. Understood formats include any date format which is
 14 * normally auto-converted when entered, without quotation marks, directly into a cell. Understood formats may depend on
 15 * region and language settings.
 16 * @returns {number} of days since 1900/1/1, inclusively.
 17 * @constructor
 18 */
 19declare let DATEVALUE: (dateString: any) => number;
 20/**
 21 * Returns a date a specified number of months before or after another date.
 22 * @param startDate - The date from which to calculate the result.
 23 * @param months - The number of months before (negative) or after (positive) start_date to calculate.
 24 * @returns {number} date a specified number of months before or after another date
 25 * @constructor
 26 */
 27declare let EDATE: (startDate: any, months: any) => number;
 28/**
 29 * Returns a date representing the last day of a month which falls a specified number of months before or after another
 30 * date.
 31 * @param startDate - The date from which to calculate the the result.
 32 * @param months - The number of months before (negative) or after (positive) start_date to consider. The last
 33 * calendar day of the calculated month is returned.
 34 * @returns {number} the last day of a month
 35 * @constructor
 36 */
 37declare let EOMONTH: (startDate: any, months: any) => number;
 38/**
 39 * Returns the day of the month that a specific date falls on, in numeric format.
 40 * @param date - The date from which to extract the day. Must be a reference to a cell containing a date, a
 41 * function returning a date type, or a number.
 42 * @returns {number} day of the month
 43 * @constructor
 44 */
 45declare let DAY: (date: any) => number;
 46/**
 47 * Returns the number of days between two dates.
 48 * @param endDate most recently occurring
 49 * @param startDate not most recently occurring
 50 * @returns {number} of days between start_date and end_date
 51 * @constructor
 52 */
 53declare let DAYS: (endDate: any, startDate: any) => number;
 54/**
 55 * Returns the difference between two days based on the 360 day year used in some financial interest calculations.
 56 * @param startDate - The start date to consider in the calculation. Must be a reference to a cell containing
 57 * a date, a function returning a date type, or a number.
 58 * @param endDate - The end date to consider in the calculation. Must be a reference to a cell containing a
 59 * date, a function returning a date type, or a number.
 60 * @param methodToUse - [ OPTIONAL - 0 by default ] - An indicator of what day count method to use.
 61 * 0 indicates the US method - Under the US method, if start_date is the last day of a month, the day of month of
 62 * start_date is changed to 30 for the purposes of the calculation. Furthermore if end_date is the last day of a month
 63 * and the day of the month of start_date is earlier than the 30th, end_date is changed to the first day of the month
 64 * following end_date, otherwise the day of month of end_date is changed to 30.
 65 * Any other value indicates the European method - Under the European method, any start_date or end_date that falls on
 66 * the 31st of a month has its day of month changed to 30.
 67 * @returns {number} of days between two dates
 68 * @constructor
 69 */
 70declare let DAYS360: (startDate: any, endDate: any, methodToUse?: any) => number;
 71/**
 72 * Returns the month of the year a specific date falls in, in numeric format.
 73 * @param date - The date from which to extract the month. Must be a reference to a cell containing a date, a
 74 * function returning a date type, or a number.
 75 * @returns {number} month of the year that the input date falls on.
 76 * @constructor
 77 */
 78declare let MONTH: (date: any) => number;
 79/**
 80 * Returns the year specified by a given date.
 81 * @param date - The date from which to calculate the year. Must be a cell reference to a cell containing a
 82 * date, a function returning a date type, or a number.
 83 * @returns {number} year of the input date
 84 * @constructor
 85 */
 86declare let YEAR: (date: any) => number;
 87/**
 88 * Returns a number representing the day of the week of the date provided.
 89 * @param date - The date for which to determine the day of the week. Must be a reference to a cell containing
 90 * a date, a function returning a date type, or a number.
 91 * @param offsetType - [ OPTIONAL - 1 by default ] - A number indicating which numbering system to use to represent
 92 * weekdays. By default counts starting with Sunday = 1. If type is 1, days are counted from Sunday and the value of
 93 * Sunday is 1, therefore the value of Saturday is 7. If type is 2, days are counted from Monday and the value of Monday
 94 * is 1, therefore the value of Sunday is 7. If type is 3, days are counted from Monday and the value of Monday is 0,
 95 * therefore the value of Sunday is 6.
 96 * @returns {number} day of week
 97 * @constructor
 98 */
 99declare let WEEKDAY: (date: any, offsetType?: any) => number;
100/**
101 * Returns a number representing the week of the year where the provided date falls. When inputting the date, it is best
102 * to use the DATE function, as text values may return errors.
103 *
104 * Behind the scenes, there are two week numbering "systems" used for this function: System 1 - The first week of the
105 * year is considered to be the week containing January 1, which is numbered week 1. System 2 - The first week of the
106 * year is considered to be the week containing the first Thursday of the year, which is numbered as week 1. System 2 is
107 * the approach specified in ISO 8601, also known as the European system for numbering weeks.
108 *
109 * @param date - The date for which to determine the week number. Must be a reference to a cell containing a
110 * date, a function returning a date type, or a number.
111 * @param shiftType - [ OPTIONAL - default is 1 ] - A number representing the day that a week starts on as well as
112 * the system used for determining the first week of the year (1=Sunday, 2=Monday).
113 * @returns {number} representing week number of year.
114 * @constructor
115 */
116declare let WEEKNUM: (date: any, shiftType?: any) => number;
117/**
118 * Calculates the number of days, months, or years between two dates.
119 * @param startDate - The start date to consider in the calculation. Must be a reference to a cell containing
120 * a DATE, a function returning a DATE type, or a number.
121 * @param endDate - The end date to consider in the calculation. Must be a reference to a cell containing a
122 * DATE, a function returning a DATE type, or a number.
123 * @param unit - A text abbreviation for unit of time. For example,"M" for month. Accepted values are "Y": the
124 * number of whole years between start_date and end_date, "M": the number of whole months between start_date and
125 * end_date, "D": the number of days between start_date and end_date, "MD": the number of days between start_date and
126 * end_date after subtracting whole months, "YM": the number of whole months between start_date and end_date after
127 * subtracting whole years, "YD": the number of days between start_date and end_date, assuming start_date and end_date
128 * were no more than one year apart.
129 * @returns {number} number of days, months, or years between two dates.
130 * @constructor
131 */
132declare let DATEDIF: (startDate: any, endDate: any, unit: any) => number;
133/**
134 * Returns the number of years, including fractional years, between two dates using a specified day count convention.
135 *
136 * Further reading:
137 *
138 * * http://christian-fries.de/blog/files/2013-yearfrac.html
139 *
140 * * http://finmath.net/finmath-lib/
141 *
142 * @param startDate - The start date to consider in the calculation. Must be a reference to a cell
143 * containing a date, a function returning a date type, or a number.
144 * @param endDate - The end date to consider in the calculation. Must be a reference to a cell containing
145 * a date, a function returning a date type, or a number.
146 * @param dayCountConvention - [ OPTIONAL - 0 by default ] - An indicator of what day count method to
147 * use.
148 * @returns {number}the number of years, including fractional years, between two dates
149 * @constructor
150 */
151declare let YEARFRAC: (startDate: any, endDate: any, dayCountConvention?: any) => number;
152/**
153 * Returns the fraction of a 24-hour day the time represents.
154 * @param timeString - The string that holds the time representation. Eg: "10am", "10:10", "10:10am", "10:10:11",
155 * or "10:10:11am".
156 * @returns {number} representing the fraction of a 24-hour day
157 * @constructor
158 */
159declare let TIMEVALUE: (timeString: any) => number;
160/**
161 * Returns the hour component of a specific time, in numeric format.
162 * @param time - The time from which to calculate the hour component. Must be a reference to a cell containing
163 * a date/time, a function returning a date/time type, or a number.
164 * @returns {number}
165 * @constructor
166 */
167declare let HOUR: (time: any) => number;
168/**
169 * Returns the minute component of a specific time, in numeric format.
170 * @param time - The time from which to calculate the minute component. Must be a reference to a cell
171 * containing a date/time, a function returning a date/time type, or a number.
172 * @returns {number} minute of the time passed in.
173 * @constructor
174 */
175declare let MINUTE: (time: any) => number;
176/**
177 * Returns the second component of a specific time, in numeric format.
178 * @param time - The time from which to calculate the second component. Must be a reference to a cell
179 * containing a date/time, a function returning a date/time type, or a number.
180 * @returns {number} second component of a specific time.
181 * @constructor
182 */
183declare let SECOND: (time: any) => number;
184/**
185 * Returns the number of net working days between two provided days.
186 * @param startDate - The start date of the period from which to calculate the number of net working days.
187 * @param endDate - The end date of the period from which to calculate the number of net working days.
188 * @param holidays - [ OPTIONAL ] - A range or array constant containing the date serial numbers to consider
189 * holidays. The values provided within an array for holidays must be date serial number values, as returned by N or
190 * date values, as returned by DATE, DATEVALUE or TO_DATE. Values specified by a range should be standard date values or
191 * date serial numbers.
192 * @returns {number} the number of net working days between two provided dates.
193 * @constructor
194 */
195declare let NETWORKDAYS: (startDate: any, endDate: any, holidays?: any) => number;
196/**
197 * Returns the number of networking days between two provided days excluding specified weekend days and holidays.
198 * @param startDate - The start date of the period from which to calculate the number of net working days.
199 * @param endDate - The end date of the period from which to calculate the number of net working days.
200 * @param weekend - [ OPTIONAL - 1 by default ] - A number or string representing which days of the week are
201 * considered weekends. String method: weekends can be specified using seven 0’s and 1’s, where the first number in the
202 * set represents Monday and the last number is for Sunday. A zero means that the day is a work day, a 1 means that the
203 * day is a weekend. For example, “0000011” would mean Saturday and Sunday are weekends. Number method: instead of using
204 * the string method above, a single number can be used. 1 = Saturday/Sunday are weekends, 2 = Sunday/Monday, and this
205 * pattern repeats until 7 = Friday/Saturday. 11 = Sunday is the only weekend, 12 = Monday is the only weekend, and this
206 * pattern repeats until 17 = Saturday is the only weekend.
207 * @param holidays - [ OPTIONAL ] - A range or array constant containing the dates to consider as holidays.
208 * The values provided within an array for holidays must be date serial number values, as returned by N or date values,
209 * as returned by DATE, DATEVALUE or TO_DATE. Values specified by a range should be standard date values or date serial
210 * numbers.
211 * @returns {number} of networking days between two provided days
212 * @constructor
213 */
214declare let NETWORKDAYS$INTL: (startDate: any, endDate: any, weekend?: any, holidays?: any) => number;
215/**
216 * Returns the current date and time as a date value.
217 * @returns {number} representing the current date and time.
218 * @constructor
219 */
220declare let NOW: () => number;
221/**
222 * Returns the current date as a date value.
223 * @returns {number} today
224 * @constructor
225 */
226declare let TODAY: () => number;
227/**
228 * Converts a provided hour, minute, and second into a time. Will silently recalculate numeric time values which fall
229 * outside of valid ranges. Eg: TIME(24, 0, 0) is the same as TIME(0, 0, 0).
230 * @param hours - The hour component of the time.
231 * @param minutes - The minute component of the time.
232 * @param seconds - The second component of the time.
233 * @returns {number} time of day
234 * @constructor
235 */
236declare let TIME: (hours: any, minutes: any, seconds: any) => number;
237/**
238 * Calculates the end date after a specified number of working days.
239 * @param startDate - The date from which to begin counting.
240 * @param numberOfDays - The number of working days to advance from start_date. If negative, counts backwards. If
241 * not an integer, truncate.
242 * @param holidays - [ OPTIONAL ] - A range or array constant containing the dates to consider holidays. The
243 * values provided within an array for holidays must be date serial number values, as returned by N or date values, as
244 * returned by DATE, DATEVALUE or TO_DATE. Values specified by a range should be standard date values or date serial
245 * numbers.
246 * @returns {number} end date after a specified number of working days.
247 * @constructor
248 */
249declare let WORKDAY: (startDate: any, numberOfDays: any, holidays?: any) => number;
250/**
251 * Calculates the date after a specified number of workdays excluding specified weekend days and holidays.
252 * @param startDate - The date from which to begin counting.
253 * @param numberOfDays - The number of working days to advance from start_date. If negative, counts backwards.
254 * @param weekend - [ OPTIONAL - 1 by default ] - A number or string representing which days of the week are
255 * considered weekends. String method: weekends can be specified using seven 0’s and 1’s, where the first number in the
256 * set represents Monday and the last number is for Sunday. A zero means that the day is a work day, a 1 means that the
257 * day is a weekend. For example, “0000011” would mean Saturday and Sunday are weekends. Number method: instead of using
258 * the string method above, a single number can be used. 1 = Saturday/Sunday are weekends, 2 = Sunday/Monday, and this
259 * pattern repeats until 7 = Friday/Saturday. 11 = Sunday is the only weekend, 12 = Monday is the only weekend, and this
260 * pattern repeats until 17 = Saturday is the only weekend.
261 * @param holidays - [ OPTIONAL ] - A range or array constant containing the dates to consider holidays.
262 * @returns {number}
263 * @constructor
264 */
265declare let WORKDAY$INTL: (startDate: any, numberOfDays: any, weekend?: any, holidays?: any) => number;
266export { DATE, DATEVALUE, DATEDIF, DAYS, DAY, DAYS360, EDATE, EOMONTH, MONTH, YEAR, WEEKDAY, WEEKNUM, YEARFRAC, TIMEVALUE, HOUR, MINUTE, SECOND, NETWORKDAYS, NETWORKDAYS$INTL, NOW, TODAY, TIME, WORKDAY, WORKDAY$INTL };