commit
message
Documentation for DATEVALUE and adding TODO to README.md
author
Ben Vogt <[email protected]>
date
2017-02-28 05:10:21
stats
2 file(s) changed,
6 insertions(+),
2 deletions(-)
files
README.md
src/RawFormulas/Date.ts
1diff --git a/README.md b/README.md
2index 2ff49f6..04904c9 100644
3--- a/README.md
4+++ b/README.md
5@@ -58,3 +58,6 @@ See `DOLLAR` function for more info.
6 Like dollars, dates are special types, but can be compared as if they're primatives. For example, this statement is
7 valid inside a cell: `=DATE(1992, 6, 6) > =DATE(1992, 6, 10)`. We should check types and and have Date-to-number
8 conversion inside parser.js.
9+
10+### `DATE` should use "roll-over" input handling
11+When handling input like DATE(1992, 1, 44), we should use momentjs's `add('days', 44)` to build up to the correct date.
12diff --git a/src/RawFormulas/Date.ts b/src/RawFormulas/Date.ts
13index 83a57a9..31f03ab 100644
14--- a/src/RawFormulas/Date.ts
15+++ b/src/RawFormulas/Date.ts
16@@ -43,8 +43,9 @@ var DATE = function (...values) {
17 * @param values[0] date_string - The string representing the date. Understood formats include any date format which is
18 * normally auto-converted when entered, without quotation marks, directly into a cell. Understood formats may depend on
19 * region and language settings. Examples include: "1/23/2012", "2012/1/23", "2012-1-23", "1-23-2012", "1/23/2012 8PM",
20- * "1/23/2012 8:10:30", "1/23/2012 8:10", "1/23/2012 8:10:300000000"
21- * @returns {number} of days since 1900/1/1
22+ * "1/23/2012 8:10:30", "1/23/2012 8:10", "1/23/2012 8:10:300000000", "Sun Feb 26 2017", "Monday Feb 26 2017",
23+ * "Mon Feb 26 2017 8PM".
24+ * @returns {number} of days since 1900/1/1, inclusively.
25 * @constructor
26 */
27 var DATEVALUE = function (...values) : number {