@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
|
(function (exports, owl) {
|
|
@@ -1202,16 +1202,84 @@
|
|
|
1202
1202
|
// -----------------------------------------------------------------------------
|
|
1203
1203
|
// Date Type
|
|
1204
1204
|
// -----------------------------------------------------------------------------
|
|
1205
|
+
/**
|
|
1206
|
+
* A DateTime object that can be used to manipulate spreadsheet dates.
|
|
1207
|
+
* Conceptually, a spreadsheet date is simply a number with a date format,
|
|
1208
|
+
* and it is timezone-agnostic.
|
|
1209
|
+
* This DateTime object consistently uses UTC time to represent a naive date and time.
|
|
1210
|
+
*/
|
|
1211
|
+
class DateTime {
|
|
1212
|
+
jsDate;
|
|
1213
|
+
constructor(year, month, day, hours = 0, minutes = 0, seconds = 0) {
|
|
1214
|
+
this.jsDate = new Date(Date.UTC(year, month, day, hours, minutes, seconds, 0));
|
|
1215
|
+
}
|
|
1216
|
+
static fromTimestamp(timestamp) {
|
|
1217
|
+
const date = new Date(timestamp);
|
|
1218
|
+
return new DateTime(date.getUTCFullYear(), date.getUTCMonth(), date.getUTCDate(), date.getUTCHours(), date.getUTCMinutes(), date.getUTCSeconds());
|
|
1219
|
+
}
|
|
1220
|
+
static now() {
|
|
1221
|
+
const now = new Date();
|
|
1222
|
+
return new DateTime(now.getFullYear(), now.getMonth(), now.getDate(), now.getHours(), now.getMinutes(), now.getSeconds());
|
|
1223
|
+
}
|
|
1224
|
+
toString() {
|
|
1225
|
+
return this.jsDate.toString();
|
|
1226
|
+
}
|
|
1227
|
+
toLocaleDateString() {
|
|
1228
|
+
return this.jsDate.toLocaleDateString();
|
|
1229
|
+
}
|
|
1230
|
+
getTime() {
|
|
1231
|
+
return this.jsDate.getTime();
|
|
1232
|
+
}
|
|
1233
|
+
getFullYear() {
|
|
1234
|
+
return this.jsDate.getUTCFullYear();
|
|
1235
|
+
}
|
|
1236
|
+
getMonth() {
|
|
1237
|
+
return this.jsDate.getUTCMonth();
|
|
1238
|
+
}
|
|
1239
|
+
getDate() {
|
|
1240
|
+
return this.jsDate.getUTCDate();
|
|
1241
|
+
}
|
|
1242
|
+
getDay() {
|
|
1243
|
+
return this.jsDate.getUTCDay();
|
|
1244
|
+
}
|
|
1245
|
+
getHours() {
|
|
1246
|
+
return this.jsDate.getUTCHours();
|
|
1247
|
+
}
|
|
1248
|
+
getMinutes() {
|
|
1249
|
+
return this.jsDate.getUTCMinutes();
|
|
1250
|
+
}
|
|
1251
|
+
getSeconds() {
|
|
1252
|
+
return this.jsDate.getUTCSeconds();
|
|
1253
|
+
}
|
|
1254
|
+
setFullYear(year) {
|
|
1255
|
+
return this.jsDate.setUTCFullYear(year);
|
|
1256
|
+
}
|
|
1257
|
+
setMonth(month) {
|
|
1258
|
+
return this.jsDate.setUTCMonth(month);
|
|
1259
|
+
}
|
|
1260
|
+
setDate(date) {
|
|
1261
|
+
return this.jsDate.setUTCDate(date);
|
|
1262
|
+
}
|
|
1263
|
+
setHours(hours) {
|
|
1264
|
+
return this.jsDate.setUTCHours(hours);
|
|
1265
|
+
}
|
|
1266
|
+
setMinutes(minutes) {
|
|
1267
|
+
return this.jsDate.setUTCMinutes(minutes);
|
|
1268
|
+
}
|
|
1269
|
+
setSeconds(seconds) {
|
|
1270
|
+
return this.jsDate.setUTCSeconds(seconds);
|
|
1271
|
+
}
|
|
1272
|
+
}
|
|
1205
1273
|
// -----------------------------------------------------------------------------
|
|
1206
1274
|
// Parsing
|
|
1207
1275
|
// -----------------------------------------------------------------------------
|
|
1208
|
-
const INITIAL_1900_DAY = new
|
|
1276
|
+
const INITIAL_1900_DAY = new DateTime(1899, 11, 30);
|
|
1209
1277
|
const MS_PER_DAY = 24 * 60 * 60 * 1000;
|
|
1210
1278
|
const CURRENT_MILLENIAL = 2000; // note: don't forget to update this in 2999
|
|
1211
|
-
const CURRENT_YEAR =
|
|
1212
|
-
const CURRENT_MONTH =
|
|
1213
|
-
const INITIAL_JS_DAY =
|
|
1214
|
-
const DATE_JS_1900_OFFSET = INITIAL_JS_DAY - INITIAL_1900_DAY;
|
|
1279
|
+
const CURRENT_YEAR = DateTime.now().getFullYear();
|
|
1280
|
+
const CURRENT_MONTH = DateTime.now().getMonth();
|
|
1281
|
+
const INITIAL_JS_DAY = DateTime.fromTimestamp(0);
|
|
1282
|
+
const DATE_JS_1900_OFFSET = INITIAL_JS_DAY.getTime() - INITIAL_1900_DAY.getTime();
|
|
1215
1283
|
const mdyDateRegexp = /^\d{1,2}(\/|-|\s)\d{1,2}((\/|-|\s)\d{1,4})?$/;
|
|
1216
1284
|
const ymdDateRegexp = /^\d{3,4}(\/|-|\s)\d{1,2}(\/|-|\s)\d{1,2}$/;
|
|
1217
1285
|
const dateSeparatorsRegex = /\/|-|\s/;
|
|
@@ -1272,7 +1340,7 @@
|
|
|
1272
1340
|
return {
|
|
1273
1341
|
value: date.value + time.value,
|
|
1274
1342
|
format: date.format + " " + (time.format === "hhhh:mm:ss" ? "hh:mm:ss" : time.format),
|
|
1275
|
-
jsDate: new
|
|
1343
|
+
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()),
|
|
1276
1344
|
};
|
|
1277
1345
|
}
|
|
1278
1346
|
return date || time;
|
|
@@ -1348,12 +1416,12 @@
|
|
|
1348
1416
|
// month + 1: months are 0-indexed in JS
|
|
1349
1417
|
const leadingZero = (monthStr?.length === 2 && month + 1 < 10) || (dayStr?.length === 2 && day < 10);
|
|
1350
1418
|
const fullYear = yearStr?.length !== 2;
|
|
1351
|
-
const jsDate = new
|
|
1419
|
+
const jsDate = new DateTime(year, month, day);
|
|
1352
1420
|
if (jsDate.getMonth() !== month || jsDate.getDate() !== day) {
|
|
1353
1421
|
// invalid date
|
|
1354
1422
|
return null;
|
|
1355
1423
|
}
|
|
1356
|
-
const delta = jsDate - INITIAL_1900_DAY;
|
|
1424
|
+
const delta = jsDate.getTime() - INITIAL_1900_DAY.getTime();
|
|
1357
1425
|
const format = getFormatFromDateParts(parts, separator, leadingZero, fullYear);
|
|
1358
1426
|
return {
|
|
1359
1427
|
value: Math.round(delta / MS_PER_DAY),
|
|
@@ -1444,7 +1512,7 @@
|
|
|
1444
1512
|
if (hours >= 24) {
|
|
1445
1513
|
format = "hhhh:mm:ss";
|
|
1446
1514
|
}
|
|
1447
|
-
const jsDate = new
|
|
1515
|
+
const jsDate = new DateTime(1899, 11, 30, hours, minutes, seconds);
|
|
1448
1516
|
return {
|
|
1449
1517
|
value: hours / 24 + minutes / 1440 + seconds / 86400,
|
|
1450
1518
|
format: format,
|
|
@@ -1458,7 +1526,7 @@
|
|
|
1458
1526
|
// -----------------------------------------------------------------------------
|
|
1459
1527
|
function numberToJsDate(value) {
|
|
1460
1528
|
const truncValue = Math.trunc(value);
|
|
1461
|
-
let date =
|
|
1529
|
+
let date = DateTime.fromTimestamp(truncValue * MS_PER_DAY - DATE_JS_1900_OFFSET);
|
|
1462
1530
|
let time = value - truncValue;
|
|
1463
1531
|
time = time < 0 ? 1 + time : time;
|
|
1464
1532
|
const hours = Math.round(time * 24);
|
|
@@ -1478,7 +1546,7 @@
|
|
|
1478
1546
|
}
|
|
1479
1547
|
/** Return the number of days in the current month of the given date */
|
|
1480
1548
|
function getDaysInMonth(date) {
|
|
1481
|
-
return new
|
|
1549
|
+
return new DateTime(date.getFullYear(), date.getMonth() + 1, 0).getDate();
|
|
1482
1550
|
}
|
|
1483
1551
|
function isLastDayOfMonth(date) {
|
|
1484
1552
|
return getDaysInMonth(date) === date.getDate();
|
|
@@ -1496,7 +1564,7 @@
|
|
|
1496
1564
|
const yStart = date.getFullYear();
|
|
1497
1565
|
const mStart = date.getMonth();
|
|
1498
1566
|
const dStart = date.getDate();
|
|
1499
|
-
const jsDate = new
|
|
1567
|
+
const jsDate = new DateTime(yStart, mStart + months, 1);
|
|
1500
1568
|
if (keepEndOfMonth && dStart === getDaysInMonth(date)) {
|
|
1501
1569
|
jsDate.setDate(getDaysInMonth(jsDate));
|
|
1502
1570
|
}
|
|
@@ -2719,20 +2787,20 @@
|
|
|
2719
2787
|
}
|
|
2720
2788
|
|
|
2721
2789
|
function toCriterionDateNumber(dateValue) {
|
|
2722
|
-
const today =
|
|
2790
|
+
const today = DateTime.now();
|
|
2723
2791
|
switch (dateValue) {
|
|
2724
2792
|
case "today":
|
|
2725
2793
|
return jsDateToNumber(today);
|
|
2726
2794
|
case "yesterday":
|
|
2727
|
-
return jsDateToNumber(
|
|
2795
|
+
return jsDateToNumber(DateTime.fromTimestamp(today.setDate(today.getDate() - 1)));
|
|
2728
2796
|
case "tomorrow":
|
|
2729
|
-
return jsDateToNumber(
|
|
2797
|
+
return jsDateToNumber(DateTime.fromTimestamp(today.setDate(today.getDate() + 1)));
|
|
2730
2798
|
case "lastWeek":
|
|
2731
|
-
return jsDateToNumber(
|
|
2799
|
+
return jsDateToNumber(DateTime.fromTimestamp(today.setDate(today.getDate() - 7)));
|
|
2732
2800
|
case "lastMonth":
|
|
2733
|
-
return jsDateToNumber(
|
|
2801
|
+
return jsDateToNumber(DateTime.fromTimestamp(today.setMonth(today.getMonth() - 1)));
|
|
2734
2802
|
case "lastYear":
|
|
2735
|
-
return jsDateToNumber(
|
|
2803
|
+
return jsDateToNumber(DateTime.fromTimestamp(today.setFullYear(today.getFullYear() - 1)));
|
|
2736
2804
|
}
|
|
2737
2805
|
}
|
|
2738
2806
|
/** Get all the dates values of a criterion converted to numbers, converting date values such as "today" to actual dates */
|
|
@@ -3090,7 +3158,7 @@
|
|
|
3090
3158
|
.map((p) => {
|
|
3091
3159
|
switch (p) {
|
|
3092
3160
|
case "hhhh":
|
|
3093
|
-
const helapsedHours = Math.floor((jsDate.getTime() - INITIAL_1900_DAY) / (60 * 60 * 1000));
|
|
3161
|
+
const helapsedHours = Math.floor((jsDate.getTime() - INITIAL_1900_DAY.getTime()) / (60 * 60 * 1000));
|
|
3094
3162
|
return helapsedHours.toString();
|
|
3095
3163
|
case "hh":
|
|
3096
3164
|
return hours.toString().padStart(2, "0");
|
|
@@ -10910,6 +10978,9 @@
|
|
|
10910
10978
|
function makeArg(str, description) {
|
|
10911
10979
|
let parts = str.match(ARG_REGEXP);
|
|
10912
10980
|
let name = parts[1].trim();
|
|
10981
|
+
if (!name) {
|
|
10982
|
+
throw new Error(`Function argument definition is missing a name: '${str}'.`);
|
|
10983
|
+
}
|
|
10913
10984
|
let types = [];
|
|
10914
10985
|
let isOptional = false;
|
|
10915
10986
|
let isRepeating = false;
|
|
@@ -14615,7 +14686,7 @@
|
|
|
14615
14686
|
if (_year < 1900) {
|
|
14616
14687
|
_year += 1900;
|
|
14617
14688
|
}
|
|
14618
|
-
const jsDate = new
|
|
14689
|
+
const jsDate = new DateTime(_year, _month - 1, _day);
|
|
14619
14690
|
const result = jsDateToRoundNumber(jsDate);
|
|
14620
14691
|
assert(() => result >= 0, _t("The function [[FUNCTION_NAME]] result must be greater than or equal 01/01/1900."));
|
|
14621
14692
|
return result;
|
|
@@ -14658,7 +14729,7 @@
|
|
|
14658
14729
|
// See: https://support.microsoft.com/en-us/office/datedif-function-25dba1a4-2812-480b-84dd-8b32a451b35c
|
|
14659
14730
|
let days = jsEndDate.getDate() - jsStartDate.getDate();
|
|
14660
14731
|
if (days < 0) {
|
|
14661
|
-
const monthBeforeEndMonth = new
|
|
14732
|
+
const monthBeforeEndMonth = new DateTime(jsEndDate.getFullYear(), jsEndDate.getMonth() - 1, 1);
|
|
14662
14733
|
const daysInMonthBeforeEndMonth = getDaysInMonth(monthBeforeEndMonth);
|
|
14663
14734
|
days = daysInMonthBeforeEndMonth - Math.abs(days);
|
|
14664
14735
|
}
|
|
@@ -14667,7 +14738,7 @@
|
|
|
14667
14738
|
if (areTwoDatesWithinOneYear(_startDate, _endDate)) {
|
|
14668
14739
|
return getTimeDifferenceInWholeDays(jsStartDate, jsEndDate);
|
|
14669
14740
|
}
|
|
14670
|
-
const endDateWithinOneYear = new
|
|
14741
|
+
const endDateWithinOneYear = new DateTime(jsStartDate.getFullYear(), jsEndDate.getMonth(), jsEndDate.getDate());
|
|
14671
14742
|
let days = getTimeDifferenceInWholeDays(jsStartDate, endDateWithinOneYear);
|
|
14672
14743
|
if (days < 0) {
|
|
14673
14744
|
endDateWithinOneYear.setFullYear(jsStartDate.getFullYear() + 1);
|
|
@@ -14784,7 +14855,7 @@
|
|
|
14784
14855
|
const _months = Math.trunc(toNumber(months, this.locale));
|
|
14785
14856
|
const yStart = _startDate.getFullYear();
|
|
14786
14857
|
const mStart = _startDate.getMonth();
|
|
14787
|
-
const jsDate = new
|
|
14858
|
+
const jsDate = new DateTime(yStart, mStart + _months + 1, 0);
|
|
14788
14859
|
return jsDateToRoundNumber(jsDate);
|
|
14789
14860
|
},
|
|
14790
14861
|
isExported: true,
|
|
@@ -14821,17 +14892,17 @@
|
|
|
14821
14892
|
// The first week of the year is the week that contains the first
|
|
14822
14893
|
// Thursday of the year.
|
|
14823
14894
|
let firstThursday = 1;
|
|
14824
|
-
while (new
|
|
14895
|
+
while (new DateTime(y, 0, firstThursday).getDay() !== 4) {
|
|
14825
14896
|
firstThursday += 1;
|
|
14826
14897
|
}
|
|
14827
|
-
const firstDayOfFirstWeek = new
|
|
14898
|
+
const firstDayOfFirstWeek = new DateTime(y, 0, firstThursday - 3);
|
|
14828
14899
|
// The last week of the year is the week that contains the last Thursday of
|
|
14829
14900
|
// the year.
|
|
14830
14901
|
let lastThursday = 31;
|
|
14831
|
-
while (new
|
|
14902
|
+
while (new DateTime(y, 11, lastThursday).getDay() !== 4) {
|
|
14832
14903
|
lastThursday -= 1;
|
|
14833
14904
|
}
|
|
14834
|
-
const lastDayOfLastWeek = new
|
|
14905
|
+
const lastDayOfLastWeek = new DateTime(y, 11, lastThursday + 3);
|
|
14835
14906
|
// B - If our date > lastDayOfLastWeek then it's in the weeks of the year after
|
|
14836
14907
|
// If our date < firstDayOfFirstWeek then it's in the weeks of the year before
|
|
14837
14908
|
let offsetYear;
|
|
@@ -14857,17 +14928,17 @@
|
|
|
14857
14928
|
case 1:
|
|
14858
14929
|
// firstDay is the 1st day of the 1st week of the year after
|
|
14859
14930
|
// firstDay = lastDayOfLastWeek + 1 Day
|
|
14860
|
-
firstDay = new
|
|
14931
|
+
firstDay = new DateTime(y, 11, lastThursday + 3 + 1);
|
|
14861
14932
|
break;
|
|
14862
14933
|
case -1:
|
|
14863
14934
|
// firstDay is the 1st day of the 1st week of the previous year.
|
|
14864
14935
|
// The first week of the previous year is the week that contains the
|
|
14865
14936
|
// first Thursday of the previous year.
|
|
14866
14937
|
let firstThursdayPreviousYear = 1;
|
|
14867
|
-
while (new
|
|
14938
|
+
while (new DateTime(y - 1, 0, firstThursdayPreviousYear).getDay() !== 4) {
|
|
14868
14939
|
firstThursdayPreviousYear += 1;
|
|
14869
14940
|
}
|
|
14870
|
-
firstDay = new
|
|
14941
|
+
firstDay = new DateTime(y - 1, 0, firstThursdayPreviousYear - 3);
|
|
14871
14942
|
break;
|
|
14872
14943
|
}
|
|
14873
14944
|
const diff = (_date.getTime() - firstDay.getTime()) / MS_PER_DAY;
|
|
@@ -15002,8 +15073,8 @@
|
|
|
15002
15073
|
});
|
|
15003
15074
|
}
|
|
15004
15075
|
const invertDate = _startDate.getTime() > _endDate.getTime();
|
|
15005
|
-
const stopDate =
|
|
15006
|
-
let stepDate =
|
|
15076
|
+
const stopDate = DateTime.fromTimestamp((invertDate ? _startDate : _endDate).getTime());
|
|
15077
|
+
let stepDate = DateTime.fromTimestamp((invertDate ? _endDate : _startDate).getTime());
|
|
15007
15078
|
const timeStopDate = stopDate.getTime();
|
|
15008
15079
|
let timeStepDate = stepDate.getTime();
|
|
15009
15080
|
let netWorkingDay = 0;
|
|
@@ -15029,8 +15100,7 @@
|
|
|
15029
15100
|
return getDateTimeFormat(this.locale);
|
|
15030
15101
|
},
|
|
15031
15102
|
compute: function () {
|
|
15032
|
-
let today =
|
|
15033
|
-
today.setMilliseconds(0);
|
|
15103
|
+
let today = DateTime.now();
|
|
15034
15104
|
const delta = today.getTime() - INITIAL_1900_DAY.getTime();
|
|
15035
15105
|
const time = today.getHours() / 24 + today.getMinutes() / 1440 + today.getSeconds() / 86400;
|
|
15036
15106
|
return Math.floor(delta / MS_PER_DAY) + time;
|
|
@@ -15104,8 +15174,8 @@
|
|
|
15104
15174
|
return this.locale.dateFormat;
|
|
15105
15175
|
},
|
|
15106
15176
|
compute: function () {
|
|
15107
|
-
const today =
|
|
15108
|
-
const jsDate = new
|
|
15177
|
+
const today = DateTime.now();
|
|
15178
|
+
const jsDate = new DateTime(today.getFullYear(), today.getMonth(), today.getDate());
|
|
15109
15179
|
return jsDateToRoundNumber(jsDate);
|
|
15110
15180
|
},
|
|
15111
15181
|
isExported: true,
|
|
@@ -15160,10 +15230,10 @@
|
|
|
15160
15230
|
}
|
|
15161
15231
|
const y = _date.getFullYear();
|
|
15162
15232
|
let dayStart = 1;
|
|
15163
|
-
let startDayOfFirstWeek = new
|
|
15233
|
+
let startDayOfFirstWeek = new DateTime(y, 0, dayStart);
|
|
15164
15234
|
while (startDayOfFirstWeek.getDay() !== startDayOfWeek) {
|
|
15165
15235
|
dayStart += 1;
|
|
15166
|
-
startDayOfFirstWeek = new
|
|
15236
|
+
startDayOfFirstWeek = new DateTime(y, 0, dayStart);
|
|
15167
15237
|
}
|
|
15168
15238
|
const dif = (_date.getTime() - startDayOfFirstWeek.getTime()) / MS_PER_DAY;
|
|
15169
15239
|
if (dif < 0) {
|
|
@@ -15221,7 +15291,7 @@
|
|
|
15221
15291
|
timesHoliday.add(holiday.getTime());
|
|
15222
15292
|
});
|
|
15223
15293
|
}
|
|
15224
|
-
let stepDate =
|
|
15294
|
+
let stepDate = DateTime.fromTimestamp(_startDate.getTime());
|
|
15225
15295
|
let timeStepDate = stepDate.getTime();
|
|
15226
15296
|
const unitDay = Math.sign(_numDays);
|
|
15227
15297
|
let stepDay = Math.abs(_numDays);
|
|
@@ -15285,7 +15355,7 @@
|
|
|
15285
15355
|
const _startDate = toJsDate(date, this.locale);
|
|
15286
15356
|
const yStart = _startDate.getFullYear();
|
|
15287
15357
|
const mStart = _startDate.getMonth();
|
|
15288
|
-
const jsDate = new
|
|
15358
|
+
const jsDate = new DateTime(yStart, mStart, 1);
|
|
15289
15359
|
return jsDateToRoundNumber(jsDate);
|
|
15290
15360
|
},
|
|
15291
15361
|
};
|
|
@@ -15327,7 +15397,7 @@
|
|
|
15327
15397
|
compute: function (date) {
|
|
15328
15398
|
const quarter = QUARTER.compute.bind(this)(date);
|
|
15329
15399
|
const year = YEAR.compute.bind(this)(date);
|
|
15330
|
-
const jsDate = new
|
|
15400
|
+
const jsDate = new DateTime(year, (quarter - 1) * 3, 1);
|
|
15331
15401
|
return jsDateToRoundNumber(jsDate);
|
|
15332
15402
|
},
|
|
15333
15403
|
};
|
|
@@ -15344,7 +15414,7 @@
|
|
|
15344
15414
|
compute: function (date) {
|
|
15345
15415
|
const quarter = QUARTER.compute.bind(this)(date);
|
|
15346
15416
|
const year = YEAR.compute.bind(this)(date);
|
|
15347
|
-
const jsDate = new
|
|
15417
|
+
const jsDate = new DateTime(year, quarter * 3, 0);
|
|
15348
15418
|
return jsDateToRoundNumber(jsDate);
|
|
15349
15419
|
},
|
|
15350
15420
|
};
|
|
@@ -15360,7 +15430,7 @@
|
|
|
15360
15430
|
},
|
|
15361
15431
|
compute: function (date) {
|
|
15362
15432
|
const year = YEAR.compute.bind(this)(date);
|
|
15363
|
-
const jsDate = new
|
|
15433
|
+
const jsDate = new DateTime(year, 0, 1);
|
|
15364
15434
|
return jsDateToRoundNumber(jsDate);
|
|
15365
15435
|
},
|
|
15366
15436
|
};
|
|
@@ -15376,7 +15446,7 @@
|
|
|
15376
15446
|
},
|
|
15377
15447
|
compute: function (date) {
|
|
15378
15448
|
const year = YEAR.compute.bind(this)(date);
|
|
15379
|
-
const jsDate = new
|
|
15449
|
+
const jsDate = new DateTime(year + 1, 0, 0);
|
|
15380
15450
|
return jsDateToRoundNumber(jsDate);
|
|
15381
15451
|
},
|
|
15382
15452
|
};
|
|
@@ -15424,8 +15494,8 @@
|
|
|
15424
15494
|
const DELTA = {
|
|
15425
15495
|
description: _t("Compare two numeric values, returning 1 if they're equal."),
|
|
15426
15496
|
args: [
|
|
15427
|
-
arg(" (number)", _t("The first number to compare.")),
|
|
15428
|
-
arg(` (number, default=${DEFAULT_DELTA_ARG})`, _t("The second number to compare.")),
|
|
15497
|
+
arg("number1 (number)", _t("The first number to compare.")),
|
|
15498
|
+
arg(`number2 (number, default=${DEFAULT_DELTA_ARG})`, _t("The second number to compare.")),
|
|
15429
15499
|
],
|
|
15430
15500
|
returns: ["NUMBER"],
|
|
15431
15501
|
compute: function (number1, number2 = DEFAULT_DELTA_ARG) {
|
|
@@ -15852,7 +15922,7 @@
|
|
|
15852
15922
|
function assertSettlementLessThanOneYearBeforeMaturity(settlement, maturity, locale) {
|
|
15853
15923
|
const startDate = toJsDate(settlement, locale);
|
|
15854
15924
|
const endDate = toJsDate(maturity, locale);
|
|
15855
|
-
const startDatePlusOneYear =
|
|
15925
|
+
const startDatePlusOneYear = toJsDate(settlement, locale);
|
|
15856
15926
|
startDatePlusOneYear.setFullYear(startDate.getFullYear() + 1);
|
|
15857
15927
|
assert(() => endDate.getTime() <= startDatePlusOneYear.getTime(), _t("The settlement date (%s) must at most one year after the maturity date (%s).", settlement.toString(), maturity.toString()));
|
|
15858
15928
|
}
|
|
@@ -15987,7 +16057,7 @@
|
|
|
15987
16057
|
arg("salvage (number)", _t("The value of the asset at the end of depreciation.")),
|
|
15988
16058
|
arg("period (number)", _t("The single period within life for which to calculate depreciation.")),
|
|
15989
16059
|
arg("rate (number)", _t("The deprecation rate.")),
|
|
15990
|
-
arg(" (number, optional)", _t("An indicator of what day count method to use.")),
|
|
16060
|
+
arg("day_count_convention (number, optional)", _t("An indicator of what day count method to use.")),
|
|
15991
16061
|
],
|
|
15992
16062
|
returns: ["NUMBER"],
|
|
15993
16063
|
compute: function (cost, purchaseDate, firstPeriodEnd, salvage, period, rate, dayCountConvention = DEFAULT_DAY_COUNT_CONVENTION) {
|
|
@@ -19011,8 +19081,8 @@
|
|
|
19011
19081
|
description: _t("A segment of a string."),
|
|
19012
19082
|
args: [
|
|
19013
19083
|
arg("text (string)", _t("The string to extract a segment from.")),
|
|
19014
|
-
arg(" (number)", _t("The index from the left of string from which to begin extracting. The first character in string has the index 1.")),
|
|
19015
|
-
arg(" (number)", _t("The length of the segment to extract.")),
|
|
19084
|
+
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.")),
|
|
19085
|
+
arg("extract_length (number)", _t("The length of the segment to extract.")),
|
|
19016
19086
|
],
|
|
19017
19087
|
returns: ["STRING"],
|
|
19018
19088
|
compute: function (text, starting_at, extract_length) {
|
|
@@ -24206,7 +24276,7 @@
|
|
|
24206
24276
|
return false;
|
|
24207
24277
|
}
|
|
24208
24278
|
if (["lastWeek", "lastMonth", "lastYear"].includes(criterion.dateValue)) {
|
|
24209
|
-
const today = jsDateToRoundNumber(
|
|
24279
|
+
const today = jsDateToRoundNumber(DateTime.now());
|
|
24210
24280
|
return isDateBetween(dateValue, today, criterionValue);
|
|
24211
24281
|
}
|
|
24212
24282
|
return areDatesSameDay(dateValue, criterionValue);
|
|
@@ -56698,9 +56768,9 @@
|
|
|
56698
56768
|
exports.tokenize = tokenize;
|
|
56699
56769
|
|
|
56700
56770
|
|
|
56701
|
-
__info__.version = "17.0.
|
|
56702
|
-
__info__.date = "2024-01-
|
|
56703
|
-
__info__.hash = "
|
|
56771
|
+
__info__.version = "17.0.7";
|
|
56772
|
+
__info__.date = "2024-01-12T13:42:04.654Z";
|
|
56773
|
+
__info__.hash = "cadb817";
|
|
56704
56774
|
|
|
56705
56775
|
|
|
56706
56776
|
})(this.o_spreadsheet = this.o_spreadsheet || {}, owl);
|