@odoo/o-spreadsheet 15.2.13 → 15.2.14

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -131,14 +131,72 @@ const FORMULA_REF_IDENTIFIER = "|";
131
131
  // -----------------------------------------------------------------------------
132
132
  // Date Type
133
133
  // -----------------------------------------------------------------------------
134
+ /**
135
+ * A DateTime object that can be used to manipulate spreadsheet dates.
136
+ * Conceptually, a spreadsheet date is simply a number with a date format,
137
+ * and it is timezone-agnostic.
138
+ * This DateTime object consistently uses UTC time to represent a naive date and time.
139
+ */
140
+ class DateTime {
141
+ constructor(year, month, day, hours = 0, minutes = 0, seconds = 0) {
142
+ this.jsDate = new Date(Date.UTC(year, month, day, hours, minutes, seconds, 0));
143
+ }
144
+ static fromTimestamp(timestamp) {
145
+ const date = new Date(timestamp);
146
+ return new DateTime(date.getUTCFullYear(), date.getUTCMonth(), date.getUTCDate(), date.getUTCHours(), date.getUTCMinutes(), date.getUTCSeconds());
147
+ }
148
+ static now() {
149
+ const now = new Date();
150
+ return new DateTime(now.getFullYear(), now.getMonth(), now.getDate(), now.getHours(), now.getMinutes(), now.getSeconds());
151
+ }
152
+ toString() {
153
+ return this.jsDate.toString();
154
+ }
155
+ getTime() {
156
+ return this.jsDate.getTime();
157
+ }
158
+ getFullYear() {
159
+ return this.jsDate.getUTCFullYear();
160
+ }
161
+ getMonth() {
162
+ return this.jsDate.getUTCMonth();
163
+ }
164
+ getDate() {
165
+ return this.jsDate.getUTCDate();
166
+ }
167
+ getDay() {
168
+ return this.jsDate.getUTCDay();
169
+ }
170
+ getHours() {
171
+ return this.jsDate.getUTCHours();
172
+ }
173
+ getMinutes() {
174
+ return this.jsDate.getUTCMinutes();
175
+ }
176
+ getSeconds() {
177
+ return this.jsDate.getUTCSeconds();
178
+ }
179
+ setDate(date) {
180
+ this.jsDate.setUTCDate(date);
181
+ }
182
+ setHours(hours) {
183
+ this.jsDate.setUTCHours(hours);
184
+ }
185
+ setMinutes(minutes) {
186
+ this.jsDate.setUTCMinutes(minutes);
187
+ }
188
+ setSeconds(seconds) {
189
+ this.jsDate.setUTCSeconds(seconds);
190
+ }
191
+ }
134
192
  // -----------------------------------------------------------------------------
135
193
  // Parsing
136
194
  // -----------------------------------------------------------------------------
137
195
  const CURRENT_MILLENIAL = 2000; // note: don't forget to update this in 2999
138
- const CURRENT_YEAR = new Date().getFullYear();
139
- const INITIAL_1900_DAY$1 = new Date(1899, 11, 30);
140
- const INITIAL_JS_DAY = new Date(0);
141
- const DATE_JS_1900_OFFSET = INITIAL_JS_DAY - INITIAL_1900_DAY$1;
196
+ const CURRENT_YEAR = DateTime.now().getFullYear();
197
+ const INITIAL_1900_DAY$1 = new DateTime(1899, 11, 30);
198
+ const INITIAL_JS_DAY = DateTime.fromTimestamp(0);
199
+ const DATE_JS_1900_OFFSET = INITIAL_JS_DAY.getTime() - INITIAL_1900_DAY$1.getTime();
142
200
  const mdyDateRegexp = /^\d{1,2}(\/|-|\s)\d{1,2}((\/|-|\s)\d{1,4})?$/;
143
201
  const ymdDateRegexp = /^\d{3,4}(\/|-|\s)\d{1,2}(\/|-|\s)\d{1,2}$/;
144
202
  const timeRegexp = /((\d+(:\d+)?(:\d+)?\s*(AM|PM))|(\d+:\d+(:\d+)?))$/;
@@ -178,7 +236,7 @@ function parseDateTime(str) {
178
236
  return {
179
237
  value: date.value + time.value,
180
238
  format: date.format + " " + (time.format === "hhhh:mm:ss" ? "hh:mm:ss" : time.format),
181
- jsDate: new Date(date.jsDate.getFullYear() + time.jsDate.getFullYear() - 1899, date.jsDate.getMonth() + time.jsDate.getMonth() - 11, date.jsDate.getDate() + time.jsDate.getDate() - 30, date.jsDate.getHours() + time.jsDate.getHours(), date.jsDate.getMinutes() + time.jsDate.getMinutes(), date.jsDate.getSeconds() + time.jsDate.getSeconds()),
239
+ jsDate: new DateTime(date.jsDate.getFullYear() + time.jsDate.getFullYear() - 1899, date.jsDate.getMonth() + time.jsDate.getMonth() - 11, date.jsDate.getDate() + time.jsDate.getDate() - 30, date.jsDate.getHours() + time.jsDate.getHours(), date.jsDate.getMinutes() + time.jsDate.getMinutes(), date.jsDate.getSeconds() + time.jsDate.getSeconds()),
182
240
  };
183
241
  }
184
242
  return date || time;
@@ -195,13 +253,13 @@ function parseDate(str, dateFormat) {
195
253
  const day = Number(parts[dayIndex]);
196
254
  const leadingZero = (parts[monthIndex].length === 2 && month < 10) || (parts[dayIndex].length === 2 && day < 10);
197
255
  const year = parts[yearIndex] ? inferYear(parts[yearIndex]) : CURRENT_YEAR;
198
- const jsDate = new Date(year, month - 1, day);
256
+ const jsDate = new DateTime(year, month - 1, day);
199
257
  const sep = str.match(/\/|-|\s/)[0];
200
258
  if (jsDate.getMonth() !== month - 1 || jsDate.getDate() !== day) {
201
259
  // invalid date
202
260
  return null;
203
261
  }
204
- const delta = jsDate - INITIAL_1900_DAY$1;
262
+ const delta = jsDate.getTime() - INITIAL_1900_DAY$1.getTime();
205
263
  let format = leadingZero ? `mm${sep}dd` : `m${sep}d`;
206
264
  if (parts[yearIndex]) {
207
265
  format = isMDY ? format + sep + "yyyy" : "yyyy" + sep + format;
@@ -261,7 +319,7 @@ function parseTime(str) {
261
319
  if (hours >= 24) {
262
320
  format = "hhhh:mm:ss";
263
321
  }
264
- const jsDate = new Date(1899, 11, 30, hours, minutes, seconds);
322
+ const jsDate = new DateTime(1899, 11, 30, hours, minutes, seconds);
265
323
  return {
266
324
  value: hours / 24 + minutes / 1440 + seconds / 86400,
267
325
  format: format,
@@ -275,7 +333,7 @@ function parseTime(str) {
275
333
  // -----------------------------------------------------------------------------
276
334
  function numberToJsDate(value) {
277
335
  const truncValue = Math.trunc(value);
278
- let date = new Date(truncValue * 86400 * 1000 - DATE_JS_1900_OFFSET);
336
+ let date = DateTime.fromTimestamp(truncValue * 86400 * 1000 - DATE_JS_1900_OFFSET);
279
337
  let time = value - truncValue;
280
338
  time = time < 0 ? 1 + time : time;
281
339
  const hours = Math.round(time * 24);
@@ -348,7 +406,7 @@ function formatJSTime(jsDate, format) {
348
406
  .map((p) => {
349
407
  switch (p) {
350
408
  case "hhhh":
351
- const helapsedHours = Math.floor((jsDate.getTime() - INITIAL_1900_DAY$1) / (60 * 60 * 1000));
409
+ const helapsedHours = Math.floor((jsDate.getTime() - INITIAL_1900_DAY$1.getTime()) / (60 * 60 * 1000));
352
410
  return helapsedHours.toString();
353
411
  case "hh":
354
412
  return hours.toString().padStart(2, "0");
@@ -2867,7 +2925,7 @@ function isBoolean(str) {
2867
2925
  function isDateTime(str) {
2868
2926
  return parseDateTime(str) !== null;
2869
2927
  }
2870
- const MARKDOWN_LINK_REGEX = /^\[([^\[]+)\]\((.+)\)$/;
2928
+ const MARKDOWN_LINK_REGEX = /^\[(.+)\]\((.+)\)$/;
2871
2929
  //link must start with http or https
2872
2930
  //https://stackoverflow.com/a/3809435/4760614
2873
2931
  const WEB_LINK_REGEX = /^https?:\/\/(www\.)?[-a-zA-Z0-9@:%._\+~#=]{2,256}\.[a-z]{2,4}\b([-a-zA-Z0-9@:%_\+.~#?&//=]*)$/;
@@ -4743,7 +4801,7 @@ var database = /*#__PURE__*/Object.freeze({
4743
4801
  DVARP: DVARP
4744
4802
  });
4745
4803
 
4746
- const INITIAL_1900_DAY = new Date(1899, 11, 30);
4804
+ const INITIAL_1900_DAY = new DateTime(1899, 11, 30);
4747
4805
  const DEFAULT_TYPE = 1;
4748
4806
  const DEFAULT_WEEKEND = 1;
4749
4807
  function isLeapYear(year) {
@@ -4772,7 +4830,7 @@ const DATE = {
4772
4830
  if (_year < 1900) {
4773
4831
  _year += 1900;
4774
4832
  }
4775
- const jsDate = new Date(_year, _month - 1, _day);
4833
+ const jsDate = new DateTime(_year, _month - 1, _day);
4776
4834
  const delta = jsDate.getTime() - INITIAL_1900_DAY.getTime();
4777
4835
  assert(() => delta >= 0, _lt(`The function [[FUNCTION_NAME]] result must be greater than or equal 01/01/1900.`));
4778
4836
  return Math.round(delta / 86400000);
@@ -4845,7 +4903,7 @@ const EDATE = {
4845
4903
  const yStart = _startDate.getFullYear();
4846
4904
  const mStart = _startDate.getMonth();
4847
4905
  const dStart = _startDate.getDate();
4848
- const jsDate = new Date(yStart, mStart + _months, dStart);
4906
+ const jsDate = new DateTime(yStart, mStart + _months, dStart);
4849
4907
  const delta = jsDate.getTime() - INITIAL_1900_DAY.getTime();
4850
4908
  return Math.round(delta / 86400000);
4851
4909
  },
@@ -4867,7 +4925,7 @@ const EOMONTH = {
4867
4925
  const _months = Math.trunc(toNumber(months));
4868
4926
  const yStart = _startDate.getFullYear();
4869
4927
  const mStart = _startDate.getMonth();
4870
- const jsDate = new Date(yStart, mStart + _months + 1, 0);
4928
+ const jsDate = new DateTime(yStart, mStart + _months + 1, 0);
4871
4929
  const delta = jsDate.getTime() - INITIAL_1900_DAY.getTime();
4872
4930
  return Math.round(delta / 86400000);
4873
4931
  },
@@ -4907,17 +4965,17 @@ const ISOWEEKNUM = {
4907
4965
  // The first week of the year is the week that contains the first
4908
4966
  // Thursday of the year.
4909
4967
  let firstThursday = 1;
4910
- while (new Date(y, 0, firstThursday).getDay() !== 4) {
4968
+ while (new DateTime(y, 0, firstThursday).getDay() !== 4) {
4911
4969
  firstThursday += 1;
4912
4970
  }
4913
- const firstDayOfFirstWeek = new Date(y, 0, firstThursday - 3);
4971
+ const firstDayOfFirstWeek = new DateTime(y, 0, firstThursday - 3);
4914
4972
  // The last week of the year is the week that contains the last Thursday of
4915
4973
  // the year.
4916
4974
  let lastThursday = 31;
4917
- while (new Date(y, 11, lastThursday).getDay() !== 4) {
4975
+ while (new DateTime(y, 11, lastThursday).getDay() !== 4) {
4918
4976
  lastThursday -= 1;
4919
4977
  }
4920
- const lastDayOfLastWeek = new Date(y, 11, lastThursday + 3);
4978
+ const lastDayOfLastWeek = new DateTime(y, 11, lastThursday + 3);
4921
4979
  // B - If our date > lastDayOfLastWeek then it's in the weeks of the year after
4922
4980
  // If our date < firstDayOfFirstWeek then it's in the weeks of the year before
4923
4981
  let offsetYear;
@@ -4943,17 +5001,17 @@ const ISOWEEKNUM = {
4943
5001
  case 1:
4944
5002
  // firstDay is the 1st day of the 1st week of the year after
4945
5003
  // firstDay = lastDayOfLastWeek + 1 Day
4946
- firstDay = new Date(y, 11, lastThursday + 3 + 1);
5004
+ firstDay = new DateTime(y, 11, lastThursday + 3 + 1);
4947
5005
  break;
4948
5006
  case -1:
4949
5007
  // firstDay is the 1st day of the 1st week of the previous year.
4950
5008
  // The first week of the previous year is the week that contains the
4951
5009
  // first Thursday of the previous year.
4952
5010
  let firstThursdayPreviousYear = 1;
4953
- while (new Date(y - 1, 0, firstThursdayPreviousYear).getDay() !== 4) {
5011
+ while (new DateTime(y - 1, 0, firstThursdayPreviousYear).getDay() !== 4) {
4954
5012
  firstThursdayPreviousYear += 1;
4955
5013
  }
4956
- firstDay = new Date(y - 1, 0, firstThursdayPreviousYear - 3);
5014
+ firstDay = new DateTime(y - 1, 0, firstThursdayPreviousYear - 3);
4957
5015
  break;
4958
5016
  }
4959
5017
  const dif = (_date.getTime() - firstDay.getTime()) / 86400000;
@@ -5092,8 +5150,8 @@ const NETWORKDAYS_INTL = {
5092
5150
  });
5093
5151
  }
5094
5152
  const invertDate = _startDate.getTime() > _endDate.getTime();
5095
- const stopDate = new Date((invertDate ? _startDate : _endDate).getTime());
5096
- let stepDate = new Date((invertDate ? _endDate : _startDate).getTime());
5153
+ const stopDate = DateTime.fromTimestamp((invertDate ? _startDate : _endDate).getTime());
5154
+ let stepDate = DateTime.fromTimestamp((invertDate ? _endDate : _startDate).getTime());
5097
5155
  const timeStopDate = stopDate.getTime();
5098
5156
  let timeStepDate = stepDate.getTime();
5099
5157
  let netWorkingDay = 0;
@@ -5117,8 +5175,7 @@ const NOW = {
5117
5175
  returns: ["DATE"],
5118
5176
  returnFormat: { specificFormat: "m/d/yyyy hh:mm:ss" },
5119
5177
  compute: function () {
5120
- let today = new Date();
5121
- today.setMilliseconds(0);
5178
+ let today = DateTime.now();
5122
5179
  const delta = today.getTime() - INITIAL_1900_DAY.getTime();
5123
5180
  const time = today.getHours() / 24 + today.getMinutes() / 1440 + today.getSeconds() / 86400;
5124
5181
  return Math.floor(delta / 86400000) + time;
@@ -5192,8 +5249,8 @@ const TODAY = {
5192
5249
  returns: ["DATE"],
5193
5250
  returnFormat: { specificFormat: "m/d/yyyy" },
5194
5251
  compute: function () {
5195
- const today = new Date();
5196
- const jsDate = new Date(today.getFullYear(), today.getMonth(), today.getDate());
5252
+ const today = DateTime.now();
5253
+ const jsDate = new DateTime(today.getFullYear(), today.getMonth(), today.getDate());
5197
5254
  const delta = jsDate.getTime() - INITIAL_1900_DAY.getTime();
5198
5255
  return Math.round(delta / 86400000);
5199
5256
  },
@@ -5249,10 +5306,10 @@ const WEEKNUM = {
5249
5306
  }
5250
5307
  const y = _date.getFullYear();
5251
5308
  let dayStart = 1;
5252
- let startDayOfFirstWeek = new Date(y, 0, dayStart);
5309
+ let startDayOfFirstWeek = new DateTime(y, 0, dayStart);
5253
5310
  while (startDayOfFirstWeek.getDay() !== startDayOfWeek) {
5254
5311
  dayStart += 1;
5255
- startDayOfFirstWeek = new Date(y, 0, dayStart);
5312
+ startDayOfFirstWeek = new DateTime(y, 0, dayStart);
5256
5313
  }
5257
5314
  const dif = (_date.getTime() - startDayOfFirstWeek.getTime()) / 86400000;
5258
5315
  if (dif < 0) {
@@ -5306,7 +5363,7 @@ const WORKDAY_INTL = {
5306
5363
  timesHoliday.add(holiday.getTime());
5307
5364
  });
5308
5365
  }
5309
- let stepDate = new Date(_startDate.getTime());
5366
+ let stepDate = DateTime.fromTimestamp(_startDate.getTime());
5310
5367
  let timeStepDate = stepDate.getTime();
5311
5368
  const unitDay = Math.sign(_numDays);
5312
5369
  let stepDay = Math.abs(_numDays);
@@ -31383,6 +31440,6 @@ exports.registries = registries;
31383
31440
  exports.setTranslationMethod = setTranslationMethod;
31384
31441
 
31385
31442
 
31386
- __info__.version = '15.2.13';
31387
- __info__.date = '2023-11-24T13:06:49.659Z';
31388
- __info__.hash = 'ea82269';
31443
+ __info__.version = '15.2.14';
31444
+ __info__.date = '2024-01-12T13:37:05.872Z';
31445
+ __info__.hash = '6515f7c';
@@ -108,14 +108,72 @@ const FORMULA_REF_IDENTIFIER = "|";
108
108
  // -----------------------------------------------------------------------------
109
109
  // Date Type
110
110
  // -----------------------------------------------------------------------------
111
+ /**
112
+ * A DateTime object that can be used to manipulate spreadsheet dates.
113
+ * Conceptually, a spreadsheet date is simply a number with a date format,
114
+ * and it is timezone-agnostic.
115
+ * This DateTime object consistently uses UTC time to represent a naive date and time.
116
+ */
117
+ class DateTime {
118
+ constructor(year, month, day, hours = 0, minutes = 0, seconds = 0) {
119
+ this.jsDate = new Date(Date.UTC(year, month, day, hours, minutes, seconds, 0));
120
+ }
121
+ static fromTimestamp(timestamp) {
122
+ const date = new Date(timestamp);
123
+ return new DateTime(date.getUTCFullYear(), date.getUTCMonth(), date.getUTCDate(), date.getUTCHours(), date.getUTCMinutes(), date.getUTCSeconds());
124
+ }
125
+ static now() {
126
+ const now = new Date();
127
+ return new DateTime(now.getFullYear(), now.getMonth(), now.getDate(), now.getHours(), now.getMinutes(), now.getSeconds());
128
+ }
129
+ toString() {
130
+ return this.jsDate.toString();
131
+ }
132
+ getTime() {
133
+ return this.jsDate.getTime();
134
+ }
135
+ getFullYear() {
136
+ return this.jsDate.getUTCFullYear();
137
+ }
138
+ getMonth() {
139
+ return this.jsDate.getUTCMonth();
140
+ }
141
+ getDate() {
142
+ return this.jsDate.getUTCDate();
143
+ }
144
+ getDay() {
145
+ return this.jsDate.getUTCDay();
146
+ }
147
+ getHours() {
148
+ return this.jsDate.getUTCHours();
149
+ }
150
+ getMinutes() {
151
+ return this.jsDate.getUTCMinutes();
152
+ }
153
+ getSeconds() {
154
+ return this.jsDate.getUTCSeconds();
155
+ }
156
+ setDate(date) {
157
+ this.jsDate.setUTCDate(date);
158
+ }
159
+ setHours(hours) {
160
+ this.jsDate.setUTCHours(hours);
161
+ }
162
+ setMinutes(minutes) {
163
+ this.jsDate.setUTCMinutes(minutes);
164
+ }
165
+ setSeconds(seconds) {
166
+ this.jsDate.setUTCSeconds(seconds);
167
+ }
168
+ }
111
169
  // -----------------------------------------------------------------------------
112
170
  // Parsing
113
171
  // -----------------------------------------------------------------------------
114
172
  const CURRENT_MILLENIAL = 2000; // note: don't forget to update this in 2999
115
- const CURRENT_YEAR = new Date().getFullYear();
116
- const INITIAL_1900_DAY$1 = new Date(1899, 11, 30);
117
- const INITIAL_JS_DAY = new Date(0);
118
- const DATE_JS_1900_OFFSET = INITIAL_JS_DAY - INITIAL_1900_DAY$1;
173
+ const CURRENT_YEAR = DateTime.now().getFullYear();
174
+ const INITIAL_1900_DAY$1 = new DateTime(1899, 11, 30);
175
+ const INITIAL_JS_DAY = DateTime.fromTimestamp(0);
176
+ const DATE_JS_1900_OFFSET = INITIAL_JS_DAY.getTime() - INITIAL_1900_DAY$1.getTime();
119
177
  const mdyDateRegexp = /^\d{1,2}(\/|-|\s)\d{1,2}((\/|-|\s)\d{1,4})?$/;
120
178
  const ymdDateRegexp = /^\d{3,4}(\/|-|\s)\d{1,2}(\/|-|\s)\d{1,2}$/;
121
179
  const timeRegexp = /((\d+(:\d+)?(:\d+)?\s*(AM|PM))|(\d+:\d+(:\d+)?))$/;
@@ -155,7 +213,7 @@ function parseDateTime(str) {
155
213
  return {
156
214
  value: date.value + time.value,
157
215
  format: date.format + " " + (time.format === "hhhh:mm:ss" ? "hh:mm:ss" : time.format),
158
- jsDate: new Date(date.jsDate.getFullYear() + time.jsDate.getFullYear() - 1899, date.jsDate.getMonth() + time.jsDate.getMonth() - 11, date.jsDate.getDate() + time.jsDate.getDate() - 30, date.jsDate.getHours() + time.jsDate.getHours(), date.jsDate.getMinutes() + time.jsDate.getMinutes(), date.jsDate.getSeconds() + time.jsDate.getSeconds()),
216
+ jsDate: new DateTime(date.jsDate.getFullYear() + time.jsDate.getFullYear() - 1899, date.jsDate.getMonth() + time.jsDate.getMonth() - 11, date.jsDate.getDate() + time.jsDate.getDate() - 30, date.jsDate.getHours() + time.jsDate.getHours(), date.jsDate.getMinutes() + time.jsDate.getMinutes(), date.jsDate.getSeconds() + time.jsDate.getSeconds()),
159
217
  };
160
218
  }
161
219
  return date || time;
@@ -172,13 +230,13 @@ function parseDate(str, dateFormat) {
172
230
  const day = Number(parts[dayIndex]);
173
231
  const leadingZero = (parts[monthIndex].length === 2 && month < 10) || (parts[dayIndex].length === 2 && day < 10);
174
232
  const year = parts[yearIndex] ? inferYear(parts[yearIndex]) : CURRENT_YEAR;
175
- const jsDate = new Date(year, month - 1, day);
233
+ const jsDate = new DateTime(year, month - 1, day);
176
234
  const sep = str.match(/\/|-|\s/)[0];
177
235
  if (jsDate.getMonth() !== month - 1 || jsDate.getDate() !== day) {
178
236
  // invalid date
179
237
  return null;
180
238
  }
181
- const delta = jsDate - INITIAL_1900_DAY$1;
239
+ const delta = jsDate.getTime() - INITIAL_1900_DAY$1.getTime();
182
240
  let format = leadingZero ? `mm${sep}dd` : `m${sep}d`;
183
241
  if (parts[yearIndex]) {
184
242
  format = isMDY ? format + sep + "yyyy" : "yyyy" + sep + format;
@@ -238,7 +296,7 @@ function parseTime(str) {
238
296
  if (hours >= 24) {
239
297
  format = "hhhh:mm:ss";
240
298
  }
241
- const jsDate = new Date(1899, 11, 30, hours, minutes, seconds);
299
+ const jsDate = new DateTime(1899, 11, 30, hours, minutes, seconds);
242
300
  return {
243
301
  value: hours / 24 + minutes / 1440 + seconds / 86400,
244
302
  format: format,
@@ -252,7 +310,7 @@ function parseTime(str) {
252
310
  // -----------------------------------------------------------------------------
253
311
  function numberToJsDate(value) {
254
312
  const truncValue = Math.trunc(value);
255
- let date = new Date(truncValue * 86400 * 1000 - DATE_JS_1900_OFFSET);
313
+ let date = DateTime.fromTimestamp(truncValue * 86400 * 1000 - DATE_JS_1900_OFFSET);
256
314
  let time = value - truncValue;
257
315
  time = time < 0 ? 1 + time : time;
258
316
  const hours = Math.round(time * 24);
@@ -325,7 +383,7 @@ function formatJSTime(jsDate, format) {
325
383
  .map((p) => {
326
384
  switch (p) {
327
385
  case "hhhh":
328
- const helapsedHours = Math.floor((jsDate.getTime() - INITIAL_1900_DAY$1) / (60 * 60 * 1000));
386
+ const helapsedHours = Math.floor((jsDate.getTime() - INITIAL_1900_DAY$1.getTime()) / (60 * 60 * 1000));
329
387
  return helapsedHours.toString();
330
388
  case "hh":
331
389
  return hours.toString().padStart(2, "0");
@@ -2844,7 +2902,7 @@ function isBoolean(str) {
2844
2902
  function isDateTime(str) {
2845
2903
  return parseDateTime(str) !== null;
2846
2904
  }
2847
- const MARKDOWN_LINK_REGEX = /^\[([^\[]+)\]\((.+)\)$/;
2905
+ const MARKDOWN_LINK_REGEX = /^\[(.+)\]\((.+)\)$/;
2848
2906
  //link must start with http or https
2849
2907
  //https://stackoverflow.com/a/3809435/4760614
2850
2908
  const WEB_LINK_REGEX = /^https?:\/\/(www\.)?[-a-zA-Z0-9@:%._\+~#=]{2,256}\.[a-z]{2,4}\b([-a-zA-Z0-9@:%_\+.~#?&//=]*)$/;
@@ -4720,7 +4778,7 @@ var database = /*#__PURE__*/Object.freeze({
4720
4778
  DVARP: DVARP
4721
4779
  });
4722
4780
 
4723
- const INITIAL_1900_DAY = new Date(1899, 11, 30);
4781
+ const INITIAL_1900_DAY = new DateTime(1899, 11, 30);
4724
4782
  const DEFAULT_TYPE = 1;
4725
4783
  const DEFAULT_WEEKEND = 1;
4726
4784
  function isLeapYear(year) {
@@ -4749,7 +4807,7 @@ const DATE = {
4749
4807
  if (_year < 1900) {
4750
4808
  _year += 1900;
4751
4809
  }
4752
- const jsDate = new Date(_year, _month - 1, _day);
4810
+ const jsDate = new DateTime(_year, _month - 1, _day);
4753
4811
  const delta = jsDate.getTime() - INITIAL_1900_DAY.getTime();
4754
4812
  assert(() => delta >= 0, _lt(`The function [[FUNCTION_NAME]] result must be greater than or equal 01/01/1900.`));
4755
4813
  return Math.round(delta / 86400000);
@@ -4822,7 +4880,7 @@ const EDATE = {
4822
4880
  const yStart = _startDate.getFullYear();
4823
4881
  const mStart = _startDate.getMonth();
4824
4882
  const dStart = _startDate.getDate();
4825
- const jsDate = new Date(yStart, mStart + _months, dStart);
4883
+ const jsDate = new DateTime(yStart, mStart + _months, dStart);
4826
4884
  const delta = jsDate.getTime() - INITIAL_1900_DAY.getTime();
4827
4885
  return Math.round(delta / 86400000);
4828
4886
  },
@@ -4844,7 +4902,7 @@ const EOMONTH = {
4844
4902
  const _months = Math.trunc(toNumber(months));
4845
4903
  const yStart = _startDate.getFullYear();
4846
4904
  const mStart = _startDate.getMonth();
4847
- const jsDate = new Date(yStart, mStart + _months + 1, 0);
4905
+ const jsDate = new DateTime(yStart, mStart + _months + 1, 0);
4848
4906
  const delta = jsDate.getTime() - INITIAL_1900_DAY.getTime();
4849
4907
  return Math.round(delta / 86400000);
4850
4908
  },
@@ -4884,17 +4942,17 @@ const ISOWEEKNUM = {
4884
4942
  // The first week of the year is the week that contains the first
4885
4943
  // Thursday of the year.
4886
4944
  let firstThursday = 1;
4887
- while (new Date(y, 0, firstThursday).getDay() !== 4) {
4945
+ while (new DateTime(y, 0, firstThursday).getDay() !== 4) {
4888
4946
  firstThursday += 1;
4889
4947
  }
4890
- const firstDayOfFirstWeek = new Date(y, 0, firstThursday - 3);
4948
+ const firstDayOfFirstWeek = new DateTime(y, 0, firstThursday - 3);
4891
4949
  // The last week of the year is the week that contains the last Thursday of
4892
4950
  // the year.
4893
4951
  let lastThursday = 31;
4894
- while (new Date(y, 11, lastThursday).getDay() !== 4) {
4952
+ while (new DateTime(y, 11, lastThursday).getDay() !== 4) {
4895
4953
  lastThursday -= 1;
4896
4954
  }
4897
- const lastDayOfLastWeek = new Date(y, 11, lastThursday + 3);
4955
+ const lastDayOfLastWeek = new DateTime(y, 11, lastThursday + 3);
4898
4956
  // B - If our date > lastDayOfLastWeek then it's in the weeks of the year after
4899
4957
  // If our date < firstDayOfFirstWeek then it's in the weeks of the year before
4900
4958
  let offsetYear;
@@ -4920,17 +4978,17 @@ const ISOWEEKNUM = {
4920
4978
  case 1:
4921
4979
  // firstDay is the 1st day of the 1st week of the year after
4922
4980
  // firstDay = lastDayOfLastWeek + 1 Day
4923
- firstDay = new Date(y, 11, lastThursday + 3 + 1);
4981
+ firstDay = new DateTime(y, 11, lastThursday + 3 + 1);
4924
4982
  break;
4925
4983
  case -1:
4926
4984
  // firstDay is the 1st day of the 1st week of the previous year.
4927
4985
  // The first week of the previous year is the week that contains the
4928
4986
  // first Thursday of the previous year.
4929
4987
  let firstThursdayPreviousYear = 1;
4930
- while (new Date(y - 1, 0, firstThursdayPreviousYear).getDay() !== 4) {
4988
+ while (new DateTime(y - 1, 0, firstThursdayPreviousYear).getDay() !== 4) {
4931
4989
  firstThursdayPreviousYear += 1;
4932
4990
  }
4933
- firstDay = new Date(y - 1, 0, firstThursdayPreviousYear - 3);
4991
+ firstDay = new DateTime(y - 1, 0, firstThursdayPreviousYear - 3);
4934
4992
  break;
4935
4993
  }
4936
4994
  const dif = (_date.getTime() - firstDay.getTime()) / 86400000;
@@ -5069,8 +5127,8 @@ const NETWORKDAYS_INTL = {
5069
5127
  });
5070
5128
  }
5071
5129
  const invertDate = _startDate.getTime() > _endDate.getTime();
5072
- const stopDate = new Date((invertDate ? _startDate : _endDate).getTime());
5073
- let stepDate = new Date((invertDate ? _endDate : _startDate).getTime());
5130
+ const stopDate = DateTime.fromTimestamp((invertDate ? _startDate : _endDate).getTime());
5131
+ let stepDate = DateTime.fromTimestamp((invertDate ? _endDate : _startDate).getTime());
5074
5132
  const timeStopDate = stopDate.getTime();
5075
5133
  let timeStepDate = stepDate.getTime();
5076
5134
  let netWorkingDay = 0;
@@ -5094,8 +5152,7 @@ const NOW = {
5094
5152
  returns: ["DATE"],
5095
5153
  returnFormat: { specificFormat: "m/d/yyyy hh:mm:ss" },
5096
5154
  compute: function () {
5097
- let today = new Date();
5098
- today.setMilliseconds(0);
5155
+ let today = DateTime.now();
5099
5156
  const delta = today.getTime() - INITIAL_1900_DAY.getTime();
5100
5157
  const time = today.getHours() / 24 + today.getMinutes() / 1440 + today.getSeconds() / 86400;
5101
5158
  return Math.floor(delta / 86400000) + time;
@@ -5169,8 +5226,8 @@ const TODAY = {
5169
5226
  returns: ["DATE"],
5170
5227
  returnFormat: { specificFormat: "m/d/yyyy" },
5171
5228
  compute: function () {
5172
- const today = new Date();
5173
- const jsDate = new Date(today.getFullYear(), today.getMonth(), today.getDate());
5229
+ const today = DateTime.now();
5230
+ const jsDate = new DateTime(today.getFullYear(), today.getMonth(), today.getDate());
5174
5231
  const delta = jsDate.getTime() - INITIAL_1900_DAY.getTime();
5175
5232
  return Math.round(delta / 86400000);
5176
5233
  },
@@ -5226,10 +5283,10 @@ const WEEKNUM = {
5226
5283
  }
5227
5284
  const y = _date.getFullYear();
5228
5285
  let dayStart = 1;
5229
- let startDayOfFirstWeek = new Date(y, 0, dayStart);
5286
+ let startDayOfFirstWeek = new DateTime(y, 0, dayStart);
5230
5287
  while (startDayOfFirstWeek.getDay() !== startDayOfWeek) {
5231
5288
  dayStart += 1;
5232
- startDayOfFirstWeek = new Date(y, 0, dayStart);
5289
+ startDayOfFirstWeek = new DateTime(y, 0, dayStart);
5233
5290
  }
5234
5291
  const dif = (_date.getTime() - startDayOfFirstWeek.getTime()) / 86400000;
5235
5292
  if (dif < 0) {
@@ -5283,7 +5340,7 @@ const WORKDAY_INTL = {
5283
5340
  timesHoliday.add(holiday.getTime());
5284
5341
  });
5285
5342
  }
5286
- let stepDate = new Date(_startDate.getTime());
5343
+ let stepDate = DateTime.fromTimestamp(_startDate.getTime());
5287
5344
  let timeStepDate = stepDate.getTime();
5288
5345
  const unitDay = Math.sign(_numDays);
5289
5346
  let stepDay = Math.abs(_numDays);
@@ -31337,6 +31394,6 @@ const helpers = {
31337
31394
  export { CommandResult, CorePlugin, DATETIME_FORMAT, DataSource, DispatchResult, Model, Registry, Revision, SPREADSHEET_DIMENSIONS, Spreadsheet, UIPlugin, DEBUG as __DEBUG__, __info__, astToFormula, cellTypes, compile, convertAstNodes, coreTypes, functionCache, helpers, invalidateEvaluationCommands, parse, readonlyAllowedCommands, registries, setTranslationMethod };
31338
31395
 
31339
31396
 
31340
- __info__.version = '15.2.13';
31341
- __info__.date = '2023-11-24T13:06:49.659Z';
31342
- __info__.hash = 'ea82269';
31397
+ __info__.version = '15.2.14';
31398
+ __info__.date = '2024-01-12T13:37:05.872Z';
31399
+ __info__.hash = '6515f7c';