@odoo/o-spreadsheet 17.0.6 → 17.0.7
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 +127 -57
- package/dist/o-spreadsheet.d.ts +30 -1
- package/dist/o-spreadsheet.esm.js +127 -57
- package/dist/o-spreadsheet.iife.js +127 -57
- package/dist/o-spreadsheet.iife.min.js +260 -260
- package/dist/o_spreadsheet.xml +3 -3
- package/package.json +1 -1
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
/**
|
|
3
3
|
* This file is generated by o-spreadsheet build tools. Do not edit it.
|
|
4
4
|
* @see https://github.com/odoo/o-spreadsheet
|
|
5
|
-
* @version 17.0.
|
|
6
|
-
* @date 2024-01-
|
|
7
|
-
* @hash
|
|
5
|
+
* @version 17.0.7
|
|
6
|
+
* @date 2024-01-12T13:42:04.654Z
|
|
7
|
+
* @hash cadb817
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
10
|
import { Component, useRef, onMounted, useEffect, onWillPatch, useState, onWillUpdateProps, onPatched, useComponent, useExternalListener, onWillUnmount, onWillStart, xml, useChildSubEnv, useSubEnv, markRaw } from '@odoo/owl';
|
|
@@ -1201,16 +1201,84 @@ function toXC(col, row, rangePart = { colFixed: false, rowFixed: false }) {
|
|
|
1201
1201
|
// -----------------------------------------------------------------------------
|
|
1202
1202
|
// Date Type
|
|
1203
1203
|
// -----------------------------------------------------------------------------
|
|
1204
|
+
/**
|
|
1205
|
+
* A DateTime object that can be used to manipulate spreadsheet dates.
|
|
1206
|
+
* Conceptually, a spreadsheet date is simply a number with a date format,
|
|
1207
|
+
* and it is timezone-agnostic.
|
|
1208
|
+
* This DateTime object consistently uses UTC time to represent a naive date and time.
|
|
1209
|
+
*/
|
|
1210
|
+
class DateTime {
|
|
1211
|
+
jsDate;
|
|
1212
|
+
constructor(year, month, day, hours = 0, minutes = 0, seconds = 0) {
|
|
1213
|
+
this.jsDate = new Date(Date.UTC(year, month, day, hours, minutes, seconds, 0));
|
|
1214
|
+
}
|
|
1215
|
+
static fromTimestamp(timestamp) {
|
|
1216
|
+
const date = new Date(timestamp);
|
|
1217
|
+
return new DateTime(date.getUTCFullYear(), date.getUTCMonth(), date.getUTCDate(), date.getUTCHours(), date.getUTCMinutes(), date.getUTCSeconds());
|
|
1218
|
+
}
|
|
1219
|
+
static now() {
|
|
1220
|
+
const now = new Date();
|
|
1221
|
+
return new DateTime(now.getFullYear(), now.getMonth(), now.getDate(), now.getHours(), now.getMinutes(), now.getSeconds());
|
|
1222
|
+
}
|
|
1223
|
+
toString() {
|
|
1224
|
+
return this.jsDate.toString();
|
|
1225
|
+
}
|
|
1226
|
+
toLocaleDateString() {
|
|
1227
|
+
return this.jsDate.toLocaleDateString();
|
|
1228
|
+
}
|
|
1229
|
+
getTime() {
|
|
1230
|
+
return this.jsDate.getTime();
|
|
1231
|
+
}
|
|
1232
|
+
getFullYear() {
|
|
1233
|
+
return this.jsDate.getUTCFullYear();
|
|
1234
|
+
}
|
|
1235
|
+
getMonth() {
|
|
1236
|
+
return this.jsDate.getUTCMonth();
|
|
1237
|
+
}
|
|
1238
|
+
getDate() {
|
|
1239
|
+
return this.jsDate.getUTCDate();
|
|
1240
|
+
}
|
|
1241
|
+
getDay() {
|
|
1242
|
+
return this.jsDate.getUTCDay();
|
|
1243
|
+
}
|
|
1244
|
+
getHours() {
|
|
1245
|
+
return this.jsDate.getUTCHours();
|
|
1246
|
+
}
|
|
1247
|
+
getMinutes() {
|
|
1248
|
+
return this.jsDate.getUTCMinutes();
|
|
1249
|
+
}
|
|
1250
|
+
getSeconds() {
|
|
1251
|
+
return this.jsDate.getUTCSeconds();
|
|
1252
|
+
}
|
|
1253
|
+
setFullYear(year) {
|
|
1254
|
+
return this.jsDate.setUTCFullYear(year);
|
|
1255
|
+
}
|
|
1256
|
+
setMonth(month) {
|
|
1257
|
+
return this.jsDate.setUTCMonth(month);
|
|
1258
|
+
}
|
|
1259
|
+
setDate(date) {
|
|
1260
|
+
return this.jsDate.setUTCDate(date);
|
|
1261
|
+
}
|
|
1262
|
+
setHours(hours) {
|
|
1263
|
+
return this.jsDate.setUTCHours(hours);
|
|
1264
|
+
}
|
|
1265
|
+
setMinutes(minutes) {
|
|
1266
|
+
return this.jsDate.setUTCMinutes(minutes);
|
|
1267
|
+
}
|
|
1268
|
+
setSeconds(seconds) {
|
|
1269
|
+
return this.jsDate.setUTCSeconds(seconds);
|
|
1270
|
+
}
|
|
1271
|
+
}
|
|
1204
1272
|
// -----------------------------------------------------------------------------
|
|
1205
1273
|
// Parsing
|
|
1206
1274
|
// -----------------------------------------------------------------------------
|
|
1207
|
-
const INITIAL_1900_DAY = new
|
|
1275
|
+
const INITIAL_1900_DAY = new DateTime(1899, 11, 30);
|
|
1208
1276
|
const MS_PER_DAY = 24 * 60 * 60 * 1000;
|
|
1209
1277
|
const CURRENT_MILLENIAL = 2000; // note: don't forget to update this in 2999
|
|
1210
|
-
const CURRENT_YEAR =
|
|
1211
|
-
const CURRENT_MONTH =
|
|
1212
|
-
const INITIAL_JS_DAY =
|
|
1213
|
-
const DATE_JS_1900_OFFSET = INITIAL_JS_DAY - INITIAL_1900_DAY;
|
|
1278
|
+
const CURRENT_YEAR = DateTime.now().getFullYear();
|
|
1279
|
+
const CURRENT_MONTH = DateTime.now().getMonth();
|
|
1280
|
+
const INITIAL_JS_DAY = DateTime.fromTimestamp(0);
|
|
1281
|
+
const DATE_JS_1900_OFFSET = INITIAL_JS_DAY.getTime() - INITIAL_1900_DAY.getTime();
|
|
1214
1282
|
const mdyDateRegexp = /^\d{1,2}(\/|-|\s)\d{1,2}((\/|-|\s)\d{1,4})?$/;
|
|
1215
1283
|
const ymdDateRegexp = /^\d{3,4}(\/|-|\s)\d{1,2}(\/|-|\s)\d{1,2}$/;
|
|
1216
1284
|
const dateSeparatorsRegex = /\/|-|\s/;
|
|
@@ -1271,7 +1339,7 @@ function _parseDateTime(str, locale) {
|
|
|
1271
1339
|
return {
|
|
1272
1340
|
value: date.value + time.value,
|
|
1273
1341
|
format: date.format + " " + (time.format === "hhhh:mm:ss" ? "hh:mm:ss" : time.format),
|
|
1274
|
-
jsDate: new
|
|
1342
|
+
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()),
|
|
1275
1343
|
};
|
|
1276
1344
|
}
|
|
1277
1345
|
return date || time;
|
|
@@ -1347,12 +1415,12 @@ function parseDate(parts, separator) {
|
|
|
1347
1415
|
// month + 1: months are 0-indexed in JS
|
|
1348
1416
|
const leadingZero = (monthStr?.length === 2 && month + 1 < 10) || (dayStr?.length === 2 && day < 10);
|
|
1349
1417
|
const fullYear = yearStr?.length !== 2;
|
|
1350
|
-
const jsDate = new
|
|
1418
|
+
const jsDate = new DateTime(year, month, day);
|
|
1351
1419
|
if (jsDate.getMonth() !== month || jsDate.getDate() !== day) {
|
|
1352
1420
|
// invalid date
|
|
1353
1421
|
return null;
|
|
1354
1422
|
}
|
|
1355
|
-
const delta = jsDate - INITIAL_1900_DAY;
|
|
1423
|
+
const delta = jsDate.getTime() - INITIAL_1900_DAY.getTime();
|
|
1356
1424
|
const format = getFormatFromDateParts(parts, separator, leadingZero, fullYear);
|
|
1357
1425
|
return {
|
|
1358
1426
|
value: Math.round(delta / MS_PER_DAY),
|
|
@@ -1443,7 +1511,7 @@ function parseTime(str) {
|
|
|
1443
1511
|
if (hours >= 24) {
|
|
1444
1512
|
format = "hhhh:mm:ss";
|
|
1445
1513
|
}
|
|
1446
|
-
const jsDate = new
|
|
1514
|
+
const jsDate = new DateTime(1899, 11, 30, hours, minutes, seconds);
|
|
1447
1515
|
return {
|
|
1448
1516
|
value: hours / 24 + minutes / 1440 + seconds / 86400,
|
|
1449
1517
|
format: format,
|
|
@@ -1457,7 +1525,7 @@ function parseTime(str) {
|
|
|
1457
1525
|
// -----------------------------------------------------------------------------
|
|
1458
1526
|
function numberToJsDate(value) {
|
|
1459
1527
|
const truncValue = Math.trunc(value);
|
|
1460
|
-
let date =
|
|
1528
|
+
let date = DateTime.fromTimestamp(truncValue * MS_PER_DAY - DATE_JS_1900_OFFSET);
|
|
1461
1529
|
let time = value - truncValue;
|
|
1462
1530
|
time = time < 0 ? 1 + time : time;
|
|
1463
1531
|
const hours = Math.round(time * 24);
|
|
@@ -1477,7 +1545,7 @@ function jsDateToNumber(date) {
|
|
|
1477
1545
|
}
|
|
1478
1546
|
/** Return the number of days in the current month of the given date */
|
|
1479
1547
|
function getDaysInMonth(date) {
|
|
1480
|
-
return new
|
|
1548
|
+
return new DateTime(date.getFullYear(), date.getMonth() + 1, 0).getDate();
|
|
1481
1549
|
}
|
|
1482
1550
|
function isLastDayOfMonth(date) {
|
|
1483
1551
|
return getDaysInMonth(date) === date.getDate();
|
|
@@ -1495,7 +1563,7 @@ function addMonthsToDate(date, months, keepEndOfMonth) {
|
|
|
1495
1563
|
const yStart = date.getFullYear();
|
|
1496
1564
|
const mStart = date.getMonth();
|
|
1497
1565
|
const dStart = date.getDate();
|
|
1498
|
-
const jsDate = new
|
|
1566
|
+
const jsDate = new DateTime(yStart, mStart + months, 1);
|
|
1499
1567
|
if (keepEndOfMonth && dStart === getDaysInMonth(date)) {
|
|
1500
1568
|
jsDate.setDate(getDaysInMonth(jsDate));
|
|
1501
1569
|
}
|
|
@@ -2718,20 +2786,20 @@ function flattenRowFirst(items, callback) {
|
|
|
2718
2786
|
}
|
|
2719
2787
|
|
|
2720
2788
|
function toCriterionDateNumber(dateValue) {
|
|
2721
|
-
const today =
|
|
2789
|
+
const today = DateTime.now();
|
|
2722
2790
|
switch (dateValue) {
|
|
2723
2791
|
case "today":
|
|
2724
2792
|
return jsDateToNumber(today);
|
|
2725
2793
|
case "yesterday":
|
|
2726
|
-
return jsDateToNumber(
|
|
2794
|
+
return jsDateToNumber(DateTime.fromTimestamp(today.setDate(today.getDate() - 1)));
|
|
2727
2795
|
case "tomorrow":
|
|
2728
|
-
return jsDateToNumber(
|
|
2796
|
+
return jsDateToNumber(DateTime.fromTimestamp(today.setDate(today.getDate() + 1)));
|
|
2729
2797
|
case "lastWeek":
|
|
2730
|
-
return jsDateToNumber(
|
|
2798
|
+
return jsDateToNumber(DateTime.fromTimestamp(today.setDate(today.getDate() - 7)));
|
|
2731
2799
|
case "lastMonth":
|
|
2732
|
-
return jsDateToNumber(
|
|
2800
|
+
return jsDateToNumber(DateTime.fromTimestamp(today.setMonth(today.getMonth() - 1)));
|
|
2733
2801
|
case "lastYear":
|
|
2734
|
-
return jsDateToNumber(
|
|
2802
|
+
return jsDateToNumber(DateTime.fromTimestamp(today.setFullYear(today.getFullYear() - 1)));
|
|
2735
2803
|
}
|
|
2736
2804
|
}
|
|
2737
2805
|
/** Get all the dates values of a criterion converted to numbers, converting date values such as "today" to actual dates */
|
|
@@ -3089,7 +3157,7 @@ function formatJSTime(jsDate, format) {
|
|
|
3089
3157
|
.map((p) => {
|
|
3090
3158
|
switch (p) {
|
|
3091
3159
|
case "hhhh":
|
|
3092
|
-
const helapsedHours = Math.floor((jsDate.getTime() - INITIAL_1900_DAY) / (60 * 60 * 1000));
|
|
3160
|
+
const helapsedHours = Math.floor((jsDate.getTime() - INITIAL_1900_DAY.getTime()) / (60 * 60 * 1000));
|
|
3093
3161
|
return helapsedHours.toString();
|
|
3094
3162
|
case "hh":
|
|
3095
3163
|
return hours.toString().padStart(2, "0");
|
|
@@ -10909,6 +10977,9 @@ function arg(definition, description = "") {
|
|
|
10909
10977
|
function makeArg(str, description) {
|
|
10910
10978
|
let parts = str.match(ARG_REGEXP);
|
|
10911
10979
|
let name = parts[1].trim();
|
|
10980
|
+
if (!name) {
|
|
10981
|
+
throw new Error(`Function argument definition is missing a name: '${str}'.`);
|
|
10982
|
+
}
|
|
10912
10983
|
let types = [];
|
|
10913
10984
|
let isOptional = false;
|
|
10914
10985
|
let isRepeating = false;
|
|
@@ -14614,7 +14685,7 @@ const DATE = {
|
|
|
14614
14685
|
if (_year < 1900) {
|
|
14615
14686
|
_year += 1900;
|
|
14616
14687
|
}
|
|
14617
|
-
const jsDate = new
|
|
14688
|
+
const jsDate = new DateTime(_year, _month - 1, _day);
|
|
14618
14689
|
const result = jsDateToRoundNumber(jsDate);
|
|
14619
14690
|
assert(() => result >= 0, _t("The function [[FUNCTION_NAME]] result must be greater than or equal 01/01/1900."));
|
|
14620
14691
|
return result;
|
|
@@ -14657,7 +14728,7 @@ const DATEDIF = {
|
|
|
14657
14728
|
// See: https://support.microsoft.com/en-us/office/datedif-function-25dba1a4-2812-480b-84dd-8b32a451b35c
|
|
14658
14729
|
let days = jsEndDate.getDate() - jsStartDate.getDate();
|
|
14659
14730
|
if (days < 0) {
|
|
14660
|
-
const monthBeforeEndMonth = new
|
|
14731
|
+
const monthBeforeEndMonth = new DateTime(jsEndDate.getFullYear(), jsEndDate.getMonth() - 1, 1);
|
|
14661
14732
|
const daysInMonthBeforeEndMonth = getDaysInMonth(monthBeforeEndMonth);
|
|
14662
14733
|
days = daysInMonthBeforeEndMonth - Math.abs(days);
|
|
14663
14734
|
}
|
|
@@ -14666,7 +14737,7 @@ const DATEDIF = {
|
|
|
14666
14737
|
if (areTwoDatesWithinOneYear(_startDate, _endDate)) {
|
|
14667
14738
|
return getTimeDifferenceInWholeDays(jsStartDate, jsEndDate);
|
|
14668
14739
|
}
|
|
14669
|
-
const endDateWithinOneYear = new
|
|
14740
|
+
const endDateWithinOneYear = new DateTime(jsStartDate.getFullYear(), jsEndDate.getMonth(), jsEndDate.getDate());
|
|
14670
14741
|
let days = getTimeDifferenceInWholeDays(jsStartDate, endDateWithinOneYear);
|
|
14671
14742
|
if (days < 0) {
|
|
14672
14743
|
endDateWithinOneYear.setFullYear(jsStartDate.getFullYear() + 1);
|
|
@@ -14783,7 +14854,7 @@ const EOMONTH = {
|
|
|
14783
14854
|
const _months = Math.trunc(toNumber(months, this.locale));
|
|
14784
14855
|
const yStart = _startDate.getFullYear();
|
|
14785
14856
|
const mStart = _startDate.getMonth();
|
|
14786
|
-
const jsDate = new
|
|
14857
|
+
const jsDate = new DateTime(yStart, mStart + _months + 1, 0);
|
|
14787
14858
|
return jsDateToRoundNumber(jsDate);
|
|
14788
14859
|
},
|
|
14789
14860
|
isExported: true,
|
|
@@ -14820,17 +14891,17 @@ const ISOWEEKNUM = {
|
|
|
14820
14891
|
// The first week of the year is the week that contains the first
|
|
14821
14892
|
// Thursday of the year.
|
|
14822
14893
|
let firstThursday = 1;
|
|
14823
|
-
while (new
|
|
14894
|
+
while (new DateTime(y, 0, firstThursday).getDay() !== 4) {
|
|
14824
14895
|
firstThursday += 1;
|
|
14825
14896
|
}
|
|
14826
|
-
const firstDayOfFirstWeek = new
|
|
14897
|
+
const firstDayOfFirstWeek = new DateTime(y, 0, firstThursday - 3);
|
|
14827
14898
|
// The last week of the year is the week that contains the last Thursday of
|
|
14828
14899
|
// the year.
|
|
14829
14900
|
let lastThursday = 31;
|
|
14830
|
-
while (new
|
|
14901
|
+
while (new DateTime(y, 11, lastThursday).getDay() !== 4) {
|
|
14831
14902
|
lastThursday -= 1;
|
|
14832
14903
|
}
|
|
14833
|
-
const lastDayOfLastWeek = new
|
|
14904
|
+
const lastDayOfLastWeek = new DateTime(y, 11, lastThursday + 3);
|
|
14834
14905
|
// B - If our date > lastDayOfLastWeek then it's in the weeks of the year after
|
|
14835
14906
|
// If our date < firstDayOfFirstWeek then it's in the weeks of the year before
|
|
14836
14907
|
let offsetYear;
|
|
@@ -14856,17 +14927,17 @@ const ISOWEEKNUM = {
|
|
|
14856
14927
|
case 1:
|
|
14857
14928
|
// firstDay is the 1st day of the 1st week of the year after
|
|
14858
14929
|
// firstDay = lastDayOfLastWeek + 1 Day
|
|
14859
|
-
firstDay = new
|
|
14930
|
+
firstDay = new DateTime(y, 11, lastThursday + 3 + 1);
|
|
14860
14931
|
break;
|
|
14861
14932
|
case -1:
|
|
14862
14933
|
// firstDay is the 1st day of the 1st week of the previous year.
|
|
14863
14934
|
// The first week of the previous year is the week that contains the
|
|
14864
14935
|
// first Thursday of the previous year.
|
|
14865
14936
|
let firstThursdayPreviousYear = 1;
|
|
14866
|
-
while (new
|
|
14937
|
+
while (new DateTime(y - 1, 0, firstThursdayPreviousYear).getDay() !== 4) {
|
|
14867
14938
|
firstThursdayPreviousYear += 1;
|
|
14868
14939
|
}
|
|
14869
|
-
firstDay = new
|
|
14940
|
+
firstDay = new DateTime(y - 1, 0, firstThursdayPreviousYear - 3);
|
|
14870
14941
|
break;
|
|
14871
14942
|
}
|
|
14872
14943
|
const diff = (_date.getTime() - firstDay.getTime()) / MS_PER_DAY;
|
|
@@ -15001,8 +15072,8 @@ const NETWORKDAYS_INTL = {
|
|
|
15001
15072
|
});
|
|
15002
15073
|
}
|
|
15003
15074
|
const invertDate = _startDate.getTime() > _endDate.getTime();
|
|
15004
|
-
const stopDate =
|
|
15005
|
-
let stepDate =
|
|
15075
|
+
const stopDate = DateTime.fromTimestamp((invertDate ? _startDate : _endDate).getTime());
|
|
15076
|
+
let stepDate = DateTime.fromTimestamp((invertDate ? _endDate : _startDate).getTime());
|
|
15006
15077
|
const timeStopDate = stopDate.getTime();
|
|
15007
15078
|
let timeStepDate = stepDate.getTime();
|
|
15008
15079
|
let netWorkingDay = 0;
|
|
@@ -15028,8 +15099,7 @@ const NOW = {
|
|
|
15028
15099
|
return getDateTimeFormat(this.locale);
|
|
15029
15100
|
},
|
|
15030
15101
|
compute: function () {
|
|
15031
|
-
let today =
|
|
15032
|
-
today.setMilliseconds(0);
|
|
15102
|
+
let today = DateTime.now();
|
|
15033
15103
|
const delta = today.getTime() - INITIAL_1900_DAY.getTime();
|
|
15034
15104
|
const time = today.getHours() / 24 + today.getMinutes() / 1440 + today.getSeconds() / 86400;
|
|
15035
15105
|
return Math.floor(delta / MS_PER_DAY) + time;
|
|
@@ -15103,8 +15173,8 @@ const TODAY = {
|
|
|
15103
15173
|
return this.locale.dateFormat;
|
|
15104
15174
|
},
|
|
15105
15175
|
compute: function () {
|
|
15106
|
-
const today =
|
|
15107
|
-
const jsDate = new
|
|
15176
|
+
const today = DateTime.now();
|
|
15177
|
+
const jsDate = new DateTime(today.getFullYear(), today.getMonth(), today.getDate());
|
|
15108
15178
|
return jsDateToRoundNumber(jsDate);
|
|
15109
15179
|
},
|
|
15110
15180
|
isExported: true,
|
|
@@ -15159,10 +15229,10 @@ const WEEKNUM = {
|
|
|
15159
15229
|
}
|
|
15160
15230
|
const y = _date.getFullYear();
|
|
15161
15231
|
let dayStart = 1;
|
|
15162
|
-
let startDayOfFirstWeek = new
|
|
15232
|
+
let startDayOfFirstWeek = new DateTime(y, 0, dayStart);
|
|
15163
15233
|
while (startDayOfFirstWeek.getDay() !== startDayOfWeek) {
|
|
15164
15234
|
dayStart += 1;
|
|
15165
|
-
startDayOfFirstWeek = new
|
|
15235
|
+
startDayOfFirstWeek = new DateTime(y, 0, dayStart);
|
|
15166
15236
|
}
|
|
15167
15237
|
const dif = (_date.getTime() - startDayOfFirstWeek.getTime()) / MS_PER_DAY;
|
|
15168
15238
|
if (dif < 0) {
|
|
@@ -15220,7 +15290,7 @@ const WORKDAY_INTL = {
|
|
|
15220
15290
|
timesHoliday.add(holiday.getTime());
|
|
15221
15291
|
});
|
|
15222
15292
|
}
|
|
15223
|
-
let stepDate =
|
|
15293
|
+
let stepDate = DateTime.fromTimestamp(_startDate.getTime());
|
|
15224
15294
|
let timeStepDate = stepDate.getTime();
|
|
15225
15295
|
const unitDay = Math.sign(_numDays);
|
|
15226
15296
|
let stepDay = Math.abs(_numDays);
|
|
@@ -15284,7 +15354,7 @@ const MONTH_START = {
|
|
|
15284
15354
|
const _startDate = toJsDate(date, this.locale);
|
|
15285
15355
|
const yStart = _startDate.getFullYear();
|
|
15286
15356
|
const mStart = _startDate.getMonth();
|
|
15287
|
-
const jsDate = new
|
|
15357
|
+
const jsDate = new DateTime(yStart, mStart, 1);
|
|
15288
15358
|
return jsDateToRoundNumber(jsDate);
|
|
15289
15359
|
},
|
|
15290
15360
|
};
|
|
@@ -15326,7 +15396,7 @@ const QUARTER_START = {
|
|
|
15326
15396
|
compute: function (date) {
|
|
15327
15397
|
const quarter = QUARTER.compute.bind(this)(date);
|
|
15328
15398
|
const year = YEAR.compute.bind(this)(date);
|
|
15329
|
-
const jsDate = new
|
|
15399
|
+
const jsDate = new DateTime(year, (quarter - 1) * 3, 1);
|
|
15330
15400
|
return jsDateToRoundNumber(jsDate);
|
|
15331
15401
|
},
|
|
15332
15402
|
};
|
|
@@ -15343,7 +15413,7 @@ const QUARTER_END = {
|
|
|
15343
15413
|
compute: function (date) {
|
|
15344
15414
|
const quarter = QUARTER.compute.bind(this)(date);
|
|
15345
15415
|
const year = YEAR.compute.bind(this)(date);
|
|
15346
|
-
const jsDate = new
|
|
15416
|
+
const jsDate = new DateTime(year, quarter * 3, 0);
|
|
15347
15417
|
return jsDateToRoundNumber(jsDate);
|
|
15348
15418
|
},
|
|
15349
15419
|
};
|
|
@@ -15359,7 +15429,7 @@ const YEAR_START = {
|
|
|
15359
15429
|
},
|
|
15360
15430
|
compute: function (date) {
|
|
15361
15431
|
const year = YEAR.compute.bind(this)(date);
|
|
15362
|
-
const jsDate = new
|
|
15432
|
+
const jsDate = new DateTime(year, 0, 1);
|
|
15363
15433
|
return jsDateToRoundNumber(jsDate);
|
|
15364
15434
|
},
|
|
15365
15435
|
};
|
|
@@ -15375,7 +15445,7 @@ const YEAR_END = {
|
|
|
15375
15445
|
},
|
|
15376
15446
|
compute: function (date) {
|
|
15377
15447
|
const year = YEAR.compute.bind(this)(date);
|
|
15378
|
-
const jsDate = new
|
|
15448
|
+
const jsDate = new DateTime(year + 1, 0, 0);
|
|
15379
15449
|
return jsDateToRoundNumber(jsDate);
|
|
15380
15450
|
},
|
|
15381
15451
|
};
|
|
@@ -15423,8 +15493,8 @@ const DEFAULT_DELTA_ARG = 0;
|
|
|
15423
15493
|
const DELTA = {
|
|
15424
15494
|
description: _t("Compare two numeric values, returning 1 if they're equal."),
|
|
15425
15495
|
args: [
|
|
15426
|
-
arg(" (number)", _t("The first number to compare.")),
|
|
15427
|
-
arg(` (number, default=${DEFAULT_DELTA_ARG})`, _t("The second number to compare.")),
|
|
15496
|
+
arg("number1 (number)", _t("The first number to compare.")),
|
|
15497
|
+
arg(`number2 (number, default=${DEFAULT_DELTA_ARG})`, _t("The second number to compare.")),
|
|
15428
15498
|
],
|
|
15429
15499
|
returns: ["NUMBER"],
|
|
15430
15500
|
compute: function (number1, number2 = DEFAULT_DELTA_ARG) {
|
|
@@ -15851,7 +15921,7 @@ function assertDeprecationFactorStrictlyPositive(factor) {
|
|
|
15851
15921
|
function assertSettlementLessThanOneYearBeforeMaturity(settlement, maturity, locale) {
|
|
15852
15922
|
const startDate = toJsDate(settlement, locale);
|
|
15853
15923
|
const endDate = toJsDate(maturity, locale);
|
|
15854
|
-
const startDatePlusOneYear =
|
|
15924
|
+
const startDatePlusOneYear = toJsDate(settlement, locale);
|
|
15855
15925
|
startDatePlusOneYear.setFullYear(startDate.getFullYear() + 1);
|
|
15856
15926
|
assert(() => endDate.getTime() <= startDatePlusOneYear.getTime(), _t("The settlement date (%s) must at most one year after the maturity date (%s).", settlement.toString(), maturity.toString()));
|
|
15857
15927
|
}
|
|
@@ -15986,7 +16056,7 @@ const AMORLINC = {
|
|
|
15986
16056
|
arg("salvage (number)", _t("The value of the asset at the end of depreciation.")),
|
|
15987
16057
|
arg("period (number)", _t("The single period within life for which to calculate depreciation.")),
|
|
15988
16058
|
arg("rate (number)", _t("The deprecation rate.")),
|
|
15989
|
-
arg(" (number, optional)", _t("An indicator of what day count method to use.")),
|
|
16059
|
+
arg("day_count_convention (number, optional)", _t("An indicator of what day count method to use.")),
|
|
15990
16060
|
],
|
|
15991
16061
|
returns: ["NUMBER"],
|
|
15992
16062
|
compute: function (cost, purchaseDate, firstPeriodEnd, salvage, period, rate, dayCountConvention = DEFAULT_DAY_COUNT_CONVENTION) {
|
|
@@ -19010,8 +19080,8 @@ const MID = {
|
|
|
19010
19080
|
description: _t("A segment of a string."),
|
|
19011
19081
|
args: [
|
|
19012
19082
|
arg("text (string)", _t("The string to extract a segment from.")),
|
|
19013
|
-
arg(" (number)", _t("The index from the left of string from which to begin extracting. The first character in string has the index 1.")),
|
|
19014
|
-
arg(" (number)", _t("The length of the segment to extract.")),
|
|
19083
|
+
arg("starting_at (number)", _t("The index from the left of string from which to begin extracting. The first character in string has the index 1.")),
|
|
19084
|
+
arg("extract_length (number)", _t("The length of the segment to extract.")),
|
|
19015
19085
|
],
|
|
19016
19086
|
returns: ["STRING"],
|
|
19017
19087
|
compute: function (text, starting_at, extract_length) {
|
|
@@ -24205,7 +24275,7 @@ dataValidationEvaluatorRegistry.add("dateIs", {
|
|
|
24205
24275
|
return false;
|
|
24206
24276
|
}
|
|
24207
24277
|
if (["lastWeek", "lastMonth", "lastYear"].includes(criterion.dateValue)) {
|
|
24208
|
-
const today = jsDateToRoundNumber(
|
|
24278
|
+
const today = jsDateToRoundNumber(DateTime.now());
|
|
24209
24279
|
return isDateBetween(dateValue, today, criterionValue);
|
|
24210
24280
|
}
|
|
24211
24281
|
return areDatesSameDay(dateValue, criterionValue);
|
|
@@ -56662,6 +56732,6 @@ const constants = {
|
|
|
56662
56732
|
export { AbstractChart, CommandResult, CorePlugin, DispatchResult, EvaluationError, Model, Registry, Revision, SPREADSHEET_DIMENSIONS, Spreadsheet, UIPlugin, __info__, addFunction, astToFormula, compile, compileTokens, components, constants, convertAstNodes, coreTypes, findCellInNewZone, functionCache, helpers, hooks, invalidateCFEvaluationCommands, invalidateDependenciesCommands, invalidateEvaluationCommands, iterateAstNodes, links, load, parse, parseTokens, readonlyAllowedCommands, registries, setDefaultSheetViewSize, setTranslationMethod, tokenize };
|
|
56663
56733
|
|
|
56664
56734
|
|
|
56665
|
-
__info__.version = "17.0.
|
|
56666
|
-
__info__.date = "2024-01-
|
|
56667
|
-
__info__.hash = "
|
|
56735
|
+
__info__.version = "17.0.7";
|
|
56736
|
+
__info__.date = "2024-01-12T13:42:04.654Z";
|
|
56737
|
+
__info__.hash = "cadb817";
|