@odoo/o-spreadsheet 16.0.27 → 16.0.29
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.
- package/dist/o-spreadsheet.cjs.js +144 -44
- package/dist/o-spreadsheet.d.ts +28 -1
- package/dist/o-spreadsheet.esm.js +144 -44
- package/dist/o-spreadsheet.iife.js +144 -44
- package/dist/o-spreadsheet.iife.min.js +246 -246
- package/dist/o_spreadsheet.xml +3 -3
- package/package.json +1 -1
|
@@ -303,15 +303,76 @@ for (let font of fontSizes) {
|
|
|
303
303
|
// -----------------------------------------------------------------------------
|
|
304
304
|
// Date Type
|
|
305
305
|
// -----------------------------------------------------------------------------
|
|
306
|
+
/**
|
|
307
|
+
* A DateTime object that can be used to manipulate spreadsheet dates.
|
|
308
|
+
* Conceptually, a spreadsheet date is simply a number with a date format,
|
|
309
|
+
* and it is timezone-agnostic.
|
|
310
|
+
* This DateTime object consistently uses UTC time to represent a naive date and time.
|
|
311
|
+
*/
|
|
312
|
+
class DateTime {
|
|
313
|
+
constructor(year, month, day, hours = 0, minutes = 0, seconds = 0) {
|
|
314
|
+
this.jsDate = new Date(Date.UTC(year, month, day, hours, minutes, seconds, 0));
|
|
315
|
+
}
|
|
316
|
+
static fromTimestamp(timestamp) {
|
|
317
|
+
const date = new Date(timestamp);
|
|
318
|
+
return new DateTime(date.getUTCFullYear(), date.getUTCMonth(), date.getUTCDate(), date.getUTCHours(), date.getUTCMinutes(), date.getUTCSeconds());
|
|
319
|
+
}
|
|
320
|
+
static now() {
|
|
321
|
+
const now = new Date();
|
|
322
|
+
return new DateTime(now.getFullYear(), now.getMonth(), now.getDate(), now.getHours(), now.getMinutes(), now.getSeconds());
|
|
323
|
+
}
|
|
324
|
+
toString() {
|
|
325
|
+
return this.jsDate.toString();
|
|
326
|
+
}
|
|
327
|
+
getTime() {
|
|
328
|
+
return this.jsDate.getTime();
|
|
329
|
+
}
|
|
330
|
+
getFullYear() {
|
|
331
|
+
return this.jsDate.getUTCFullYear();
|
|
332
|
+
}
|
|
333
|
+
getMonth() {
|
|
334
|
+
return this.jsDate.getUTCMonth();
|
|
335
|
+
}
|
|
336
|
+
getDate() {
|
|
337
|
+
return this.jsDate.getUTCDate();
|
|
338
|
+
}
|
|
339
|
+
getDay() {
|
|
340
|
+
return this.jsDate.getUTCDay();
|
|
341
|
+
}
|
|
342
|
+
getHours() {
|
|
343
|
+
return this.jsDate.getUTCHours();
|
|
344
|
+
}
|
|
345
|
+
getMinutes() {
|
|
346
|
+
return this.jsDate.getUTCMinutes();
|
|
347
|
+
}
|
|
348
|
+
getSeconds() {
|
|
349
|
+
return this.jsDate.getUTCSeconds();
|
|
350
|
+
}
|
|
351
|
+
setFullYear(year) {
|
|
352
|
+
this.jsDate.setFullYear(year);
|
|
353
|
+
}
|
|
354
|
+
setDate(date) {
|
|
355
|
+
this.jsDate.setUTCDate(date);
|
|
356
|
+
}
|
|
357
|
+
setHours(hours) {
|
|
358
|
+
this.jsDate.setUTCHours(hours);
|
|
359
|
+
}
|
|
360
|
+
setMinutes(minutes) {
|
|
361
|
+
this.jsDate.setUTCMinutes(minutes);
|
|
362
|
+
}
|
|
363
|
+
setSeconds(seconds) {
|
|
364
|
+
this.jsDate.setUTCSeconds(seconds);
|
|
365
|
+
}
|
|
366
|
+
}
|
|
306
367
|
// -----------------------------------------------------------------------------
|
|
307
368
|
// Parsing
|
|
308
369
|
// -----------------------------------------------------------------------------
|
|
309
|
-
const INITIAL_1900_DAY = new
|
|
370
|
+
const INITIAL_1900_DAY = new DateTime(1899, 11, 30);
|
|
310
371
|
const MS_PER_DAY = 24 * 60 * 60 * 1000;
|
|
311
372
|
const CURRENT_MILLENIAL = 2000; // note: don't forget to update this in 2999
|
|
312
|
-
const CURRENT_YEAR =
|
|
313
|
-
const INITIAL_JS_DAY =
|
|
314
|
-
const DATE_JS_1900_OFFSET = INITIAL_JS_DAY - INITIAL_1900_DAY;
|
|
373
|
+
const CURRENT_YEAR = DateTime.now().getFullYear();
|
|
374
|
+
const INITIAL_JS_DAY = DateTime.fromTimestamp(0);
|
|
375
|
+
const DATE_JS_1900_OFFSET = INITIAL_JS_DAY.getTime() - INITIAL_1900_DAY.getTime();
|
|
315
376
|
const mdyDateRegexp = /^\d{1,2}(\/|-|\s)\d{1,2}((\/|-|\s)\d{1,4})?$/;
|
|
316
377
|
const ymdDateRegexp = /^\d{3,4}(\/|-|\s)\d{1,2}(\/|-|\s)\d{1,2}$/;
|
|
317
378
|
const timeRegexp = /((\d+(:\d+)?(:\d+)?\s*(AM|PM))|(\d+:\d+(:\d+)?))$/;
|
|
@@ -360,7 +421,7 @@ function _parseDateTime(str) {
|
|
|
360
421
|
return {
|
|
361
422
|
value: date.value + time.value,
|
|
362
423
|
format: date.format + " " + (time.format === "hhhh:mm:ss" ? "hh:mm:ss" : time.format),
|
|
363
|
-
jsDate: new
|
|
424
|
+
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()),
|
|
364
425
|
};
|
|
365
426
|
}
|
|
366
427
|
return date || time;
|
|
@@ -377,13 +438,13 @@ function parseDate(str, dateFormat) {
|
|
|
377
438
|
const day = Number(parts[dayIndex]);
|
|
378
439
|
const leadingZero = (parts[monthIndex].length === 2 && month < 10) || (parts[dayIndex].length === 2 && day < 10);
|
|
379
440
|
const year = parts[yearIndex] ? inferYear(parts[yearIndex]) : CURRENT_YEAR;
|
|
380
|
-
const jsDate = new
|
|
441
|
+
const jsDate = new DateTime(year, month - 1, day);
|
|
381
442
|
const sep = str.match(/\/|-|\s/)[0];
|
|
382
443
|
if (jsDate.getMonth() !== month - 1 || jsDate.getDate() !== day) {
|
|
383
444
|
// invalid date
|
|
384
445
|
return null;
|
|
385
446
|
}
|
|
386
|
-
const delta = jsDate - INITIAL_1900_DAY;
|
|
447
|
+
const delta = jsDate.getTime() - INITIAL_1900_DAY.getTime();
|
|
387
448
|
let format = leadingZero ? `mm${sep}dd` : `m${sep}d`;
|
|
388
449
|
if (parts[yearIndex]) {
|
|
389
450
|
format = isMDY ? format + sep + "yyyy" : "yyyy" + sep + format;
|
|
@@ -443,7 +504,7 @@ function parseTime(str) {
|
|
|
443
504
|
if (hours >= 24) {
|
|
444
505
|
format = "hhhh:mm:ss";
|
|
445
506
|
}
|
|
446
|
-
const jsDate = new
|
|
507
|
+
const jsDate = new DateTime(1899, 11, 30, hours, minutes, seconds);
|
|
447
508
|
return {
|
|
448
509
|
value: hours / 24 + minutes / 1440 + seconds / 86400,
|
|
449
510
|
format: format,
|
|
@@ -457,7 +518,7 @@ function parseTime(str) {
|
|
|
457
518
|
// -----------------------------------------------------------------------------
|
|
458
519
|
function numberToJsDate(value) {
|
|
459
520
|
const truncValue = Math.trunc(value);
|
|
460
|
-
let date =
|
|
521
|
+
let date = DateTime.fromTimestamp(truncValue * MS_PER_DAY - DATE_JS_1900_OFFSET);
|
|
461
522
|
let time = value - truncValue;
|
|
462
523
|
time = time < 0 ? 1 + time : time;
|
|
463
524
|
const hours = Math.round(time * 24);
|
|
@@ -474,7 +535,7 @@ function jsDateToRoundNumber(date) {
|
|
|
474
535
|
}
|
|
475
536
|
/** Return the number of days in the current month of the given date */
|
|
476
537
|
function getDaysInMonth(date) {
|
|
477
|
-
return new
|
|
538
|
+
return new DateTime(date.getFullYear(), date.getMonth() + 1, 0).getDate();
|
|
478
539
|
}
|
|
479
540
|
function isLastDayOfMonth(date) {
|
|
480
541
|
return getDaysInMonth(date) === date.getDate();
|
|
@@ -492,7 +553,7 @@ function addMonthsToDate(date, months, keepEndOfMonth) {
|
|
|
492
553
|
const yStart = date.getFullYear();
|
|
493
554
|
const mStart = date.getMonth();
|
|
494
555
|
const dStart = date.getDate();
|
|
495
|
-
const jsDate = new
|
|
556
|
+
const jsDate = new DateTime(yStart, mStart + months, 1);
|
|
496
557
|
if (keepEndOfMonth && dStart === getDaysInMonth(date)) {
|
|
497
558
|
jsDate.setDate(getDaysInMonth(jsDate));
|
|
498
559
|
}
|
|
@@ -845,7 +906,7 @@ function isBoolean(str) {
|
|
|
845
906
|
function isDateTime(str) {
|
|
846
907
|
return parseDateTime(str) !== null;
|
|
847
908
|
}
|
|
848
|
-
const MARKDOWN_LINK_REGEX = /^\[(
|
|
909
|
+
const MARKDOWN_LINK_REGEX = /^\[(.+)\]\((.+)\)$/;
|
|
849
910
|
//link must start with http or https
|
|
850
911
|
//https://stackoverflow.com/a/3809435/4760614
|
|
851
912
|
const WEB_LINK_REGEX = /^https?:\/\/(www\.)?[-a-zA-Z0-9@:%._\+~#=]{2,256}\.[a-z]{2,4}\b([-a-zA-Z0-9@:%_\+.~#?&//=]*)$/;
|
|
@@ -1500,6 +1561,31 @@ const MAX_DECIMAL_PLACES = 20;
|
|
|
1500
1561
|
//from https://stackoverflow.com/questions/721304/insert-commas-into-number-string @Thomas/Alan Moore
|
|
1501
1562
|
const thousandsGroupsRegexp = /(\d+?)(?=(\d{3})+(?!\d)|$)/g;
|
|
1502
1563
|
const zeroRegexp = /0/g;
|
|
1564
|
+
// TODO in the future : remove these constants MONTHS/DAYS, and use a library such as luxon to handle it
|
|
1565
|
+
// + possibly handle automatic translation of day/month
|
|
1566
|
+
const MONTHS = {
|
|
1567
|
+
0: _lt("January"),
|
|
1568
|
+
1: _lt("February"),
|
|
1569
|
+
2: _lt("March"),
|
|
1570
|
+
3: _lt("April"),
|
|
1571
|
+
4: _lt("May"),
|
|
1572
|
+
5: _lt("June"),
|
|
1573
|
+
6: _lt("July"),
|
|
1574
|
+
7: _lt("August"),
|
|
1575
|
+
8: _lt("September"),
|
|
1576
|
+
9: _lt("October"),
|
|
1577
|
+
10: _lt("November"),
|
|
1578
|
+
11: _lt("December"),
|
|
1579
|
+
};
|
|
1580
|
+
const DAYS$1 = {
|
|
1581
|
+
0: _lt("Sunday"),
|
|
1582
|
+
1: _lt("Monday"),
|
|
1583
|
+
2: _lt("Tuesday"),
|
|
1584
|
+
3: _lt("Wednesday"),
|
|
1585
|
+
4: _lt("Thursday"),
|
|
1586
|
+
5: _lt("Friday"),
|
|
1587
|
+
6: _lt("Saturday"),
|
|
1588
|
+
};
|
|
1503
1589
|
// -----------------------------------------------------------------------------
|
|
1504
1590
|
// FORMAT REPRESENTATION CACHE
|
|
1505
1591
|
// -----------------------------------------------------------------------------
|
|
@@ -1732,8 +1818,9 @@ function applyDateTimeFormat(value, format) {
|
|
|
1732
1818
|
return strDate + (strDate && strTime ? " " : "") + strTime;
|
|
1733
1819
|
}
|
|
1734
1820
|
function formatJSDate(jsDate, format) {
|
|
1735
|
-
|
|
1736
|
-
const
|
|
1821
|
+
var _a;
|
|
1822
|
+
const sep = (_a = format.match(/\/|-|\s/)) === null || _a === void 0 ? void 0 : _a[0];
|
|
1823
|
+
const parts = sep ? format.split(sep) : [format];
|
|
1737
1824
|
return parts
|
|
1738
1825
|
.map((p) => {
|
|
1739
1826
|
switch (p) {
|
|
@@ -1741,10 +1828,23 @@ function formatJSDate(jsDate, format) {
|
|
|
1741
1828
|
return jsDate.getDate();
|
|
1742
1829
|
case "dd":
|
|
1743
1830
|
return jsDate.getDate().toString().padStart(2, "0");
|
|
1831
|
+
case "ddd":
|
|
1832
|
+
return DAYS$1[jsDate.getDay()].slice(0, 3);
|
|
1833
|
+
case "dddd":
|
|
1834
|
+
return DAYS$1[jsDate.getDay()];
|
|
1744
1835
|
case "m":
|
|
1745
1836
|
return jsDate.getMonth() + 1;
|
|
1746
1837
|
case "mm":
|
|
1747
1838
|
return String(jsDate.getMonth() + 1).padStart(2, "0");
|
|
1839
|
+
case "mmm":
|
|
1840
|
+
return MONTHS[jsDate.getMonth()].slice(0, 3);
|
|
1841
|
+
case "mmmm":
|
|
1842
|
+
return MONTHS[jsDate.getMonth()];
|
|
1843
|
+
case "mmmmm":
|
|
1844
|
+
return MONTHS[jsDate.getMonth()].slice(0, 1);
|
|
1845
|
+
case "yy":
|
|
1846
|
+
const fullYear = String(jsDate.getFullYear()).replace("-", "").padStart(2, "0");
|
|
1847
|
+
return fullYear.slice(fullYear.length - 2);
|
|
1748
1848
|
case "yyyy":
|
|
1749
1849
|
return jsDate.getFullYear();
|
|
1750
1850
|
default:
|
|
@@ -1768,7 +1868,7 @@ function formatJSTime(jsDate, format) {
|
|
|
1768
1868
|
.map((p) => {
|
|
1769
1869
|
switch (p) {
|
|
1770
1870
|
case "hhhh":
|
|
1771
|
-
const helapsedHours = Math.floor((jsDate.getTime() - INITIAL_1900_DAY) / (60 * 60 * 1000));
|
|
1871
|
+
const helapsedHours = Math.floor((jsDate.getTime() - INITIAL_1900_DAY.getTime()) / (60 * 60 * 1000));
|
|
1772
1872
|
return helapsedHours.toString();
|
|
1773
1873
|
case "hh":
|
|
1774
1874
|
return hours.toString().padStart(2, "0");
|
|
@@ -13844,7 +13944,7 @@ const DATE = {
|
|
|
13844
13944
|
if (_year < 1900) {
|
|
13845
13945
|
_year += 1900;
|
|
13846
13946
|
}
|
|
13847
|
-
const jsDate = new
|
|
13947
|
+
const jsDate = new DateTime(_year, _month - 1, _day);
|
|
13848
13948
|
const result = jsDateToRoundNumber(jsDate);
|
|
13849
13949
|
assert(() => result >= 0, _lt(`The function [[FUNCTION_NAME]] result must be greater than or equal 01/01/1900.`));
|
|
13850
13950
|
return result;
|
|
@@ -13956,7 +14056,7 @@ const EOMONTH = {
|
|
|
13956
14056
|
const _months = Math.trunc(toNumber(months));
|
|
13957
14057
|
const yStart = _startDate.getFullYear();
|
|
13958
14058
|
const mStart = _startDate.getMonth();
|
|
13959
|
-
const jsDate = new
|
|
14059
|
+
const jsDate = new DateTime(yStart, mStart + _months + 1, 0);
|
|
13960
14060
|
return jsDateToRoundNumber(jsDate);
|
|
13961
14061
|
},
|
|
13962
14062
|
isExported: true,
|
|
@@ -13995,17 +14095,17 @@ const ISOWEEKNUM = {
|
|
|
13995
14095
|
// The first week of the year is the week that contains the first
|
|
13996
14096
|
// Thursday of the year.
|
|
13997
14097
|
let firstThursday = 1;
|
|
13998
|
-
while (new
|
|
14098
|
+
while (new DateTime(y, 0, firstThursday).getDay() !== 4) {
|
|
13999
14099
|
firstThursday += 1;
|
|
14000
14100
|
}
|
|
14001
|
-
const firstDayOfFirstWeek = new
|
|
14101
|
+
const firstDayOfFirstWeek = new DateTime(y, 0, firstThursday - 3);
|
|
14002
14102
|
// The last week of the year is the week that contains the last Thursday of
|
|
14003
14103
|
// the year.
|
|
14004
14104
|
let lastThursday = 31;
|
|
14005
|
-
while (new
|
|
14105
|
+
while (new DateTime(y, 11, lastThursday).getDay() !== 4) {
|
|
14006
14106
|
lastThursday -= 1;
|
|
14007
14107
|
}
|
|
14008
|
-
const lastDayOfLastWeek = new
|
|
14108
|
+
const lastDayOfLastWeek = new DateTime(y, 11, lastThursday + 3);
|
|
14009
14109
|
// B - If our date > lastDayOfLastWeek then it's in the weeks of the year after
|
|
14010
14110
|
// If our date < firstDayOfFirstWeek then it's in the weeks of the year before
|
|
14011
14111
|
let offsetYear;
|
|
@@ -14031,17 +14131,17 @@ const ISOWEEKNUM = {
|
|
|
14031
14131
|
case 1:
|
|
14032
14132
|
// firstDay is the 1st day of the 1st week of the year after
|
|
14033
14133
|
// firstDay = lastDayOfLastWeek + 1 Day
|
|
14034
|
-
firstDay = new
|
|
14134
|
+
firstDay = new DateTime(y, 11, lastThursday + 3 + 1);
|
|
14035
14135
|
break;
|
|
14036
14136
|
case -1:
|
|
14037
14137
|
// firstDay is the 1st day of the 1st week of the previous year.
|
|
14038
14138
|
// The first week of the previous year is the week that contains the
|
|
14039
14139
|
// first Thursday of the previous year.
|
|
14040
14140
|
let firstThursdayPreviousYear = 1;
|
|
14041
|
-
while (new
|
|
14141
|
+
while (new DateTime(y - 1, 0, firstThursdayPreviousYear).getDay() !== 4) {
|
|
14042
14142
|
firstThursdayPreviousYear += 1;
|
|
14043
14143
|
}
|
|
14044
|
-
firstDay = new
|
|
14144
|
+
firstDay = new DateTime(y - 1, 0, firstThursdayPreviousYear - 3);
|
|
14045
14145
|
break;
|
|
14046
14146
|
}
|
|
14047
14147
|
const diff = (_date.getTime() - firstDay.getTime()) / MS_PER_DAY;
|
|
@@ -14180,8 +14280,8 @@ const NETWORKDAYS_INTL = {
|
|
|
14180
14280
|
});
|
|
14181
14281
|
}
|
|
14182
14282
|
const invertDate = _startDate.getTime() > _endDate.getTime();
|
|
14183
|
-
const stopDate =
|
|
14184
|
-
let stepDate =
|
|
14283
|
+
const stopDate = DateTime.fromTimestamp((invertDate ? _startDate : _endDate).getTime());
|
|
14284
|
+
let stepDate = DateTime.fromTimestamp((invertDate ? _endDate : _startDate).getTime());
|
|
14185
14285
|
const timeStopDate = stopDate.getTime();
|
|
14186
14286
|
let timeStepDate = stepDate.getTime();
|
|
14187
14287
|
let netWorkingDay = 0;
|
|
@@ -14205,8 +14305,7 @@ const NOW = {
|
|
|
14205
14305
|
returns: ["DATE"],
|
|
14206
14306
|
computeFormat: () => "m/d/yyyy hh:mm:ss",
|
|
14207
14307
|
compute: function () {
|
|
14208
|
-
let today =
|
|
14209
|
-
today.setMilliseconds(0);
|
|
14308
|
+
let today = DateTime.now();
|
|
14210
14309
|
const delta = today.getTime() - INITIAL_1900_DAY.getTime();
|
|
14211
14310
|
const time = today.getHours() / 24 + today.getMinutes() / 1440 + today.getSeconds() / 86400;
|
|
14212
14311
|
return Math.floor(delta / MS_PER_DAY) + time;
|
|
@@ -14280,8 +14379,8 @@ const TODAY = {
|
|
|
14280
14379
|
returns: ["DATE"],
|
|
14281
14380
|
computeFormat: () => "m/d/yyyy",
|
|
14282
14381
|
compute: function () {
|
|
14283
|
-
const today =
|
|
14284
|
-
const jsDate = new
|
|
14382
|
+
const today = DateTime.now();
|
|
14383
|
+
const jsDate = new DateTime(today.getFullYear(), today.getMonth(), today.getDate());
|
|
14285
14384
|
return jsDateToRoundNumber(jsDate);
|
|
14286
14385
|
},
|
|
14287
14386
|
isExported: true,
|
|
@@ -14336,10 +14435,10 @@ const WEEKNUM = {
|
|
|
14336
14435
|
}
|
|
14337
14436
|
const y = _date.getFullYear();
|
|
14338
14437
|
let dayStart = 1;
|
|
14339
|
-
let startDayOfFirstWeek = new
|
|
14438
|
+
let startDayOfFirstWeek = new DateTime(y, 0, dayStart);
|
|
14340
14439
|
while (startDayOfFirstWeek.getDay() !== startDayOfWeek) {
|
|
14341
14440
|
dayStart += 1;
|
|
14342
|
-
startDayOfFirstWeek = new
|
|
14441
|
+
startDayOfFirstWeek = new DateTime(y, 0, dayStart);
|
|
14343
14442
|
}
|
|
14344
14443
|
const dif = (_date.getTime() - startDayOfFirstWeek.getTime()) / MS_PER_DAY;
|
|
14345
14444
|
if (dif < 0) {
|
|
@@ -14393,7 +14492,7 @@ const WORKDAY_INTL = {
|
|
|
14393
14492
|
timesHoliday.add(holiday.getTime());
|
|
14394
14493
|
});
|
|
14395
14494
|
}
|
|
14396
|
-
let stepDate =
|
|
14495
|
+
let stepDate = DateTime.fromTimestamp(_startDate.getTime());
|
|
14397
14496
|
let timeStepDate = stepDate.getTime();
|
|
14398
14497
|
const unitDay = Math.sign(_numDays);
|
|
14399
14498
|
let stepDay = Math.abs(_numDays);
|
|
@@ -14459,7 +14558,7 @@ const MONTH_START = {
|
|
|
14459
14558
|
const _startDate = toJsDate(date);
|
|
14460
14559
|
const yStart = _startDate.getFullYear();
|
|
14461
14560
|
const mStart = _startDate.getMonth();
|
|
14462
|
-
const jsDate = new
|
|
14561
|
+
const jsDate = new DateTime(yStart, mStart, 1);
|
|
14463
14562
|
return jsDateToRoundNumber(jsDate);
|
|
14464
14563
|
},
|
|
14465
14564
|
};
|
|
@@ -14503,7 +14602,7 @@ const QUARTER_START = {
|
|
|
14503
14602
|
compute: function (date) {
|
|
14504
14603
|
const quarter = QUARTER.compute(date);
|
|
14505
14604
|
const year = YEAR.compute(date);
|
|
14506
|
-
const jsDate = new
|
|
14605
|
+
const jsDate = new DateTime(year, (quarter - 1) * 3, 1);
|
|
14507
14606
|
return jsDateToRoundNumber(jsDate);
|
|
14508
14607
|
},
|
|
14509
14608
|
};
|
|
@@ -14520,7 +14619,7 @@ const QUARTER_END = {
|
|
|
14520
14619
|
compute: function (date) {
|
|
14521
14620
|
const quarter = QUARTER.compute(date);
|
|
14522
14621
|
const year = YEAR.compute(date);
|
|
14523
|
-
const jsDate = new
|
|
14622
|
+
const jsDate = new DateTime(year, quarter * 3, 0);
|
|
14524
14623
|
return jsDateToRoundNumber(jsDate);
|
|
14525
14624
|
},
|
|
14526
14625
|
};
|
|
@@ -14536,7 +14635,7 @@ const YEAR_START = {
|
|
|
14536
14635
|
computeFormat: () => "m/d/yyyy",
|
|
14537
14636
|
compute: function (date) {
|
|
14538
14637
|
const year = YEAR.compute(date);
|
|
14539
|
-
const jsDate = new
|
|
14638
|
+
const jsDate = new DateTime(year, 0, 1);
|
|
14540
14639
|
return jsDateToRoundNumber(jsDate);
|
|
14541
14640
|
},
|
|
14542
14641
|
};
|
|
@@ -14552,7 +14651,7 @@ const YEAR_END = {
|
|
|
14552
14651
|
computeFormat: () => "m/d/yyyy",
|
|
14553
14652
|
compute: function (date) {
|
|
14554
14653
|
const year = YEAR.compute(date);
|
|
14555
|
-
const jsDate = new
|
|
14654
|
+
const jsDate = new DateTime(year + 1, 0, 0);
|
|
14556
14655
|
return jsDateToRoundNumber(jsDate);
|
|
14557
14656
|
},
|
|
14558
14657
|
};
|
|
@@ -14686,7 +14785,7 @@ function assertDeprecationFactorStrictlyPositive(factor) {
|
|
|
14686
14785
|
function assertSettlementLessThanOneYearBeforeMaturity(settlement, maturity) {
|
|
14687
14786
|
const startDate = toJsDate(settlement);
|
|
14688
14787
|
const endDate = toJsDate(maturity);
|
|
14689
|
-
const startDatePlusOneYear =
|
|
14788
|
+
const startDatePlusOneYear = toJsDate(settlement);
|
|
14690
14789
|
startDatePlusOneYear.setFullYear(startDate.getFullYear() + 1);
|
|
14691
14790
|
assert(() => endDate.getTime() <= startDatePlusOneYear.getTime(), _lt("The settlement date (%s) must at most one year after the maturity date (%s).", settlement.toString(), maturity.toString()));
|
|
14692
14791
|
}
|
|
@@ -40424,9 +40523,10 @@ class RangeAdapter {
|
|
|
40424
40523
|
* Get a Xc string that represent a part of a range
|
|
40425
40524
|
*/
|
|
40426
40525
|
getRangePartString(range, part) {
|
|
40427
|
-
|
|
40526
|
+
var _a, _b;
|
|
40527
|
+
const colFixed = range.parts && ((_a = range.parts[part]) === null || _a === void 0 ? void 0 : _a.colFixed) ? "$" : "";
|
|
40428
40528
|
const col = part === 0 ? numberToLetters(range.zone.left) : numberToLetters(range.zone.right);
|
|
40429
|
-
const rowFixed = range.parts && range.parts[part].rowFixed ? "$" : "";
|
|
40529
|
+
const rowFixed = range.parts && ((_b = range.parts[part]) === null || _b === void 0 ? void 0 : _b.rowFixed) ? "$" : "";
|
|
40430
40530
|
const row = part === 0 ? String(range.zone.top + 1) : String(range.zone.bottom + 1);
|
|
40431
40531
|
let str = "";
|
|
40432
40532
|
if (range.isFullCol) {
|
|
@@ -43039,6 +43139,6 @@ function addFunction(functionName, functionDescription) {
|
|
|
43039
43139
|
export { AbstractChart, CommandResult, CorePlugin, DATETIME_FORMAT, DispatchResult, EvaluationError, Model, Registry, Revision, SPREADSHEET_DIMENSIONS, Spreadsheet, UIPlugin, __info__, addFunction, astToFormula, cellTypes, compile, components, convertAstNodes, coreTypes, findCellInNewZone, functionCache, helpers, invalidateEvaluationCommands, load, parse, readonlyAllowedCommands, registries, setTranslationMethod, tokenize };
|
|
43040
43140
|
|
|
43041
43141
|
|
|
43042
|
-
__info__.version = '16.0.
|
|
43043
|
-
__info__.date = '2024-01-
|
|
43044
|
-
__info__.hash = '
|
|
43142
|
+
__info__.version = '16.0.29';
|
|
43143
|
+
__info__.date = '2024-01-17T10:24:52.885Z';
|
|
43144
|
+
__info__.hash = '3fda985';
|