@odoo/o-spreadsheet 16.2.26 → 16.2.27
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 +107 -44
- package/dist/o-spreadsheet.d.ts +28 -1
- package/dist/o-spreadsheet.esm.js +107 -44
- package/dist/o-spreadsheet.iife.js +107 -44
- package/dist/o-spreadsheet.iife.min.js +243 -243
- package/dist/o_spreadsheet.xml +3 -3
- package/package.json +1 -1
|
@@ -290,15 +290,76 @@ const FONT_SIZES = [6, 7, 8, 9, 10, 11, 12, 14, 18, 24, 36];
|
|
|
290
290
|
// -----------------------------------------------------------------------------
|
|
291
291
|
// Date Type
|
|
292
292
|
// -----------------------------------------------------------------------------
|
|
293
|
+
/**
|
|
294
|
+
* A DateTime object that can be used to manipulate spreadsheet dates.
|
|
295
|
+
* Conceptually, a spreadsheet date is simply a number with a date format,
|
|
296
|
+
* and it is timezone-agnostic.
|
|
297
|
+
* This DateTime object consistently uses UTC time to represent a naive date and time.
|
|
298
|
+
*/
|
|
299
|
+
class DateTime {
|
|
300
|
+
constructor(year, month, day, hours = 0, minutes = 0, seconds = 0) {
|
|
301
|
+
this.jsDate = new Date(Date.UTC(year, month, day, hours, minutes, seconds, 0));
|
|
302
|
+
}
|
|
303
|
+
static fromTimestamp(timestamp) {
|
|
304
|
+
const date = new Date(timestamp);
|
|
305
|
+
return new DateTime(date.getUTCFullYear(), date.getUTCMonth(), date.getUTCDate(), date.getUTCHours(), date.getUTCMinutes(), date.getUTCSeconds());
|
|
306
|
+
}
|
|
307
|
+
static now() {
|
|
308
|
+
const now = new Date();
|
|
309
|
+
return new DateTime(now.getFullYear(), now.getMonth(), now.getDate(), now.getHours(), now.getMinutes(), now.getSeconds());
|
|
310
|
+
}
|
|
311
|
+
toString() {
|
|
312
|
+
return this.jsDate.toString();
|
|
313
|
+
}
|
|
314
|
+
getTime() {
|
|
315
|
+
return this.jsDate.getTime();
|
|
316
|
+
}
|
|
317
|
+
getFullYear() {
|
|
318
|
+
return this.jsDate.getUTCFullYear();
|
|
319
|
+
}
|
|
320
|
+
getMonth() {
|
|
321
|
+
return this.jsDate.getUTCMonth();
|
|
322
|
+
}
|
|
323
|
+
getDate() {
|
|
324
|
+
return this.jsDate.getUTCDate();
|
|
325
|
+
}
|
|
326
|
+
getDay() {
|
|
327
|
+
return this.jsDate.getUTCDay();
|
|
328
|
+
}
|
|
329
|
+
getHours() {
|
|
330
|
+
return this.jsDate.getUTCHours();
|
|
331
|
+
}
|
|
332
|
+
getMinutes() {
|
|
333
|
+
return this.jsDate.getUTCMinutes();
|
|
334
|
+
}
|
|
335
|
+
getSeconds() {
|
|
336
|
+
return this.jsDate.getUTCSeconds();
|
|
337
|
+
}
|
|
338
|
+
setFullYear(year) {
|
|
339
|
+
this.jsDate.setFullYear(year);
|
|
340
|
+
}
|
|
341
|
+
setDate(date) {
|
|
342
|
+
this.jsDate.setUTCDate(date);
|
|
343
|
+
}
|
|
344
|
+
setHours(hours) {
|
|
345
|
+
this.jsDate.setUTCHours(hours);
|
|
346
|
+
}
|
|
347
|
+
setMinutes(minutes) {
|
|
348
|
+
this.jsDate.setUTCMinutes(minutes);
|
|
349
|
+
}
|
|
350
|
+
setSeconds(seconds) {
|
|
351
|
+
this.jsDate.setUTCSeconds(seconds);
|
|
352
|
+
}
|
|
353
|
+
}
|
|
293
354
|
// -----------------------------------------------------------------------------
|
|
294
355
|
// Parsing
|
|
295
356
|
// -----------------------------------------------------------------------------
|
|
296
|
-
const INITIAL_1900_DAY = new
|
|
357
|
+
const INITIAL_1900_DAY = new DateTime(1899, 11, 30);
|
|
297
358
|
const MS_PER_DAY = 24 * 60 * 60 * 1000;
|
|
298
359
|
const CURRENT_MILLENIAL = 2000; // note: don't forget to update this in 2999
|
|
299
|
-
const CURRENT_YEAR =
|
|
300
|
-
const INITIAL_JS_DAY =
|
|
301
|
-
const DATE_JS_1900_OFFSET = INITIAL_JS_DAY - INITIAL_1900_DAY;
|
|
360
|
+
const CURRENT_YEAR = DateTime.now().getFullYear();
|
|
361
|
+
const INITIAL_JS_DAY = DateTime.fromTimestamp(0);
|
|
362
|
+
const DATE_JS_1900_OFFSET = INITIAL_JS_DAY.getTime() - INITIAL_1900_DAY.getTime();
|
|
302
363
|
const mdyDateRegexp = /^\d{1,2}(\/|-|\s)\d{1,2}((\/|-|\s)\d{1,4})?$/;
|
|
303
364
|
const ymdDateRegexp = /^\d{3,4}(\/|-|\s)\d{1,2}(\/|-|\s)\d{1,2}$/;
|
|
304
365
|
const timeRegexp = /((\d+(:\d+)?(:\d+)?\s*(AM|PM))|(\d+:\d+(:\d+)?))$/;
|
|
@@ -347,7 +408,7 @@ function _parseDateTime(str) {
|
|
|
347
408
|
return {
|
|
348
409
|
value: date.value + time.value,
|
|
349
410
|
format: date.format + " " + (time.format === "hhhh:mm:ss" ? "hh:mm:ss" : time.format),
|
|
350
|
-
jsDate: new
|
|
411
|
+
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()),
|
|
351
412
|
};
|
|
352
413
|
}
|
|
353
414
|
return date || time;
|
|
@@ -364,13 +425,13 @@ function parseDate(str, dateFormat) {
|
|
|
364
425
|
const day = Number(parts[dayIndex]);
|
|
365
426
|
const leadingZero = (parts[monthIndex].length === 2 && month < 10) || (parts[dayIndex].length === 2 && day < 10);
|
|
366
427
|
const year = parts[yearIndex] ? inferYear(parts[yearIndex]) : CURRENT_YEAR;
|
|
367
|
-
const jsDate = new
|
|
428
|
+
const jsDate = new DateTime(year, month - 1, day);
|
|
368
429
|
const sep = str.match(/\/|-|\s/)[0];
|
|
369
430
|
if (jsDate.getMonth() !== month - 1 || jsDate.getDate() !== day) {
|
|
370
431
|
// invalid date
|
|
371
432
|
return null;
|
|
372
433
|
}
|
|
373
|
-
const delta = jsDate - INITIAL_1900_DAY;
|
|
434
|
+
const delta = jsDate.getTime() - INITIAL_1900_DAY.getTime();
|
|
374
435
|
let format = leadingZero ? `mm${sep}dd` : `m${sep}d`;
|
|
375
436
|
if (parts[yearIndex]) {
|
|
376
437
|
format = isMDY ? format + sep + "yyyy" : "yyyy" + sep + format;
|
|
@@ -430,7 +491,7 @@ function parseTime(str) {
|
|
|
430
491
|
if (hours >= 24) {
|
|
431
492
|
format = "hhhh:mm:ss";
|
|
432
493
|
}
|
|
433
|
-
const jsDate = new
|
|
494
|
+
const jsDate = new DateTime(1899, 11, 30, hours, minutes, seconds);
|
|
434
495
|
return {
|
|
435
496
|
value: hours / 24 + minutes / 1440 + seconds / 86400,
|
|
436
497
|
format: format,
|
|
@@ -444,7 +505,7 @@ function parseTime(str) {
|
|
|
444
505
|
// -----------------------------------------------------------------------------
|
|
445
506
|
function numberToJsDate(value) {
|
|
446
507
|
const truncValue = Math.trunc(value);
|
|
447
|
-
let date =
|
|
508
|
+
let date = DateTime.fromTimestamp(truncValue * MS_PER_DAY - DATE_JS_1900_OFFSET);
|
|
448
509
|
let time = value - truncValue;
|
|
449
510
|
time = time < 0 ? 1 + time : time;
|
|
450
511
|
const hours = Math.round(time * 24);
|
|
@@ -461,7 +522,7 @@ function jsDateToRoundNumber(date) {
|
|
|
461
522
|
}
|
|
462
523
|
/** Return the number of days in the current month of the given date */
|
|
463
524
|
function getDaysInMonth(date) {
|
|
464
|
-
return new
|
|
525
|
+
return new DateTime(date.getFullYear(), date.getMonth() + 1, 0).getDate();
|
|
465
526
|
}
|
|
466
527
|
function isLastDayOfMonth(date) {
|
|
467
528
|
return getDaysInMonth(date) === date.getDate();
|
|
@@ -479,7 +540,7 @@ function addMonthsToDate(date, months, keepEndOfMonth) {
|
|
|
479
540
|
const yStart = date.getFullYear();
|
|
480
541
|
const mStart = date.getMonth();
|
|
481
542
|
const dStart = date.getDate();
|
|
482
|
-
const jsDate = new
|
|
543
|
+
const jsDate = new DateTime(yStart, mStart + months, 1);
|
|
483
544
|
if (keepEndOfMonth && dStart === getDaysInMonth(date)) {
|
|
484
545
|
jsDate.setDate(getDaysInMonth(jsDate));
|
|
485
546
|
}
|
|
@@ -1900,7 +1961,7 @@ function formatJSTime(jsDate, format) {
|
|
|
1900
1961
|
.map((p) => {
|
|
1901
1962
|
switch (p) {
|
|
1902
1963
|
case "hhhh":
|
|
1903
|
-
const helapsedHours = Math.floor((jsDate.getTime() - INITIAL_1900_DAY) / (60 * 60 * 1000));
|
|
1964
|
+
const helapsedHours = Math.floor((jsDate.getTime() - INITIAL_1900_DAY.getTime()) / (60 * 60 * 1000));
|
|
1904
1965
|
return helapsedHours.toString();
|
|
1905
1966
|
case "hh":
|
|
1906
1967
|
return hours.toString().padStart(2, "0");
|
|
@@ -9496,6 +9557,9 @@ function arg(definition, description = "") {
|
|
|
9496
9557
|
function makeArg(str) {
|
|
9497
9558
|
let parts = str.match(ARG_REGEXP);
|
|
9498
9559
|
let name = parts[1].trim();
|
|
9560
|
+
if (!name) {
|
|
9561
|
+
throw new Error(`Function argument definition is missing a name: '${str}'.`);
|
|
9562
|
+
}
|
|
9499
9563
|
let types = [];
|
|
9500
9564
|
let isOptional = false;
|
|
9501
9565
|
let isRepeating = false;
|
|
@@ -11959,7 +12023,7 @@ const DATE = {
|
|
|
11959
12023
|
if (_year < 1900) {
|
|
11960
12024
|
_year += 1900;
|
|
11961
12025
|
}
|
|
11962
|
-
const jsDate = new
|
|
12026
|
+
const jsDate = new DateTime(_year, _month - 1, _day);
|
|
11963
12027
|
const result = jsDateToRoundNumber(jsDate);
|
|
11964
12028
|
assert(() => result >= 0, _lt(`The function [[FUNCTION_NAME]] result must be greater than or equal 01/01/1900.`));
|
|
11965
12029
|
return result;
|
|
@@ -12067,7 +12131,7 @@ const EOMONTH = {
|
|
|
12067
12131
|
const _months = Math.trunc(toNumber(months));
|
|
12068
12132
|
const yStart = _startDate.getFullYear();
|
|
12069
12133
|
const mStart = _startDate.getMonth();
|
|
12070
|
-
const jsDate = new
|
|
12134
|
+
const jsDate = new DateTime(yStart, mStart + _months + 1, 0);
|
|
12071
12135
|
return jsDateToRoundNumber(jsDate);
|
|
12072
12136
|
},
|
|
12073
12137
|
isExported: true,
|
|
@@ -12104,17 +12168,17 @@ const ISOWEEKNUM = {
|
|
|
12104
12168
|
// The first week of the year is the week that contains the first
|
|
12105
12169
|
// Thursday of the year.
|
|
12106
12170
|
let firstThursday = 1;
|
|
12107
|
-
while (new
|
|
12171
|
+
while (new DateTime(y, 0, firstThursday).getDay() !== 4) {
|
|
12108
12172
|
firstThursday += 1;
|
|
12109
12173
|
}
|
|
12110
|
-
const firstDayOfFirstWeek = new
|
|
12174
|
+
const firstDayOfFirstWeek = new DateTime(y, 0, firstThursday - 3);
|
|
12111
12175
|
// The last week of the year is the week that contains the last Thursday of
|
|
12112
12176
|
// the year.
|
|
12113
12177
|
let lastThursday = 31;
|
|
12114
|
-
while (new
|
|
12178
|
+
while (new DateTime(y, 11, lastThursday).getDay() !== 4) {
|
|
12115
12179
|
lastThursday -= 1;
|
|
12116
12180
|
}
|
|
12117
|
-
const lastDayOfLastWeek = new
|
|
12181
|
+
const lastDayOfLastWeek = new DateTime(y, 11, lastThursday + 3);
|
|
12118
12182
|
// B - If our date > lastDayOfLastWeek then it's in the weeks of the year after
|
|
12119
12183
|
// If our date < firstDayOfFirstWeek then it's in the weeks of the year before
|
|
12120
12184
|
let offsetYear;
|
|
@@ -12140,17 +12204,17 @@ const ISOWEEKNUM = {
|
|
|
12140
12204
|
case 1:
|
|
12141
12205
|
// firstDay is the 1st day of the 1st week of the year after
|
|
12142
12206
|
// firstDay = lastDayOfLastWeek + 1 Day
|
|
12143
|
-
firstDay = new
|
|
12207
|
+
firstDay = new DateTime(y, 11, lastThursday + 3 + 1);
|
|
12144
12208
|
break;
|
|
12145
12209
|
case -1:
|
|
12146
12210
|
// firstDay is the 1st day of the 1st week of the previous year.
|
|
12147
12211
|
// The first week of the previous year is the week that contains the
|
|
12148
12212
|
// first Thursday of the previous year.
|
|
12149
12213
|
let firstThursdayPreviousYear = 1;
|
|
12150
|
-
while (new
|
|
12214
|
+
while (new DateTime(y - 1, 0, firstThursdayPreviousYear).getDay() !== 4) {
|
|
12151
12215
|
firstThursdayPreviousYear += 1;
|
|
12152
12216
|
}
|
|
12153
|
-
firstDay = new
|
|
12217
|
+
firstDay = new DateTime(y - 1, 0, firstThursdayPreviousYear - 3);
|
|
12154
12218
|
break;
|
|
12155
12219
|
}
|
|
12156
12220
|
const diff = (_date.getTime() - firstDay.getTime()) / MS_PER_DAY;
|
|
@@ -12285,8 +12349,8 @@ const NETWORKDAYS_INTL = {
|
|
|
12285
12349
|
});
|
|
12286
12350
|
}
|
|
12287
12351
|
const invertDate = _startDate.getTime() > _endDate.getTime();
|
|
12288
|
-
const stopDate =
|
|
12289
|
-
let stepDate =
|
|
12352
|
+
const stopDate = DateTime.fromTimestamp((invertDate ? _startDate : _endDate).getTime());
|
|
12353
|
+
let stepDate = DateTime.fromTimestamp((invertDate ? _endDate : _startDate).getTime());
|
|
12290
12354
|
const timeStopDate = stopDate.getTime();
|
|
12291
12355
|
let timeStepDate = stepDate.getTime();
|
|
12292
12356
|
let netWorkingDay = 0;
|
|
@@ -12310,8 +12374,7 @@ const NOW = {
|
|
|
12310
12374
|
returns: ["DATE"],
|
|
12311
12375
|
computeFormat: () => "m/d/yyyy hh:mm:ss",
|
|
12312
12376
|
compute: function () {
|
|
12313
|
-
let today =
|
|
12314
|
-
today.setMilliseconds(0);
|
|
12377
|
+
let today = DateTime.now();
|
|
12315
12378
|
const delta = today.getTime() - INITIAL_1900_DAY.getTime();
|
|
12316
12379
|
const time = today.getHours() / 24 + today.getMinutes() / 1440 + today.getSeconds() / 86400;
|
|
12317
12380
|
return Math.floor(delta / MS_PER_DAY) + time;
|
|
@@ -12381,8 +12444,8 @@ const TODAY = {
|
|
|
12381
12444
|
returns: ["DATE"],
|
|
12382
12445
|
computeFormat: () => "m/d/yyyy",
|
|
12383
12446
|
compute: function () {
|
|
12384
|
-
const today =
|
|
12385
|
-
const jsDate = new
|
|
12447
|
+
const today = DateTime.now();
|
|
12448
|
+
const jsDate = new DateTime(today.getFullYear(), today.getMonth(), today.getDate());
|
|
12386
12449
|
return jsDateToRoundNumber(jsDate);
|
|
12387
12450
|
},
|
|
12388
12451
|
isExported: true,
|
|
@@ -12437,10 +12500,10 @@ const WEEKNUM = {
|
|
|
12437
12500
|
}
|
|
12438
12501
|
const y = _date.getFullYear();
|
|
12439
12502
|
let dayStart = 1;
|
|
12440
|
-
let startDayOfFirstWeek = new
|
|
12503
|
+
let startDayOfFirstWeek = new DateTime(y, 0, dayStart);
|
|
12441
12504
|
while (startDayOfFirstWeek.getDay() !== startDayOfWeek) {
|
|
12442
12505
|
dayStart += 1;
|
|
12443
|
-
startDayOfFirstWeek = new
|
|
12506
|
+
startDayOfFirstWeek = new DateTime(y, 0, dayStart);
|
|
12444
12507
|
}
|
|
12445
12508
|
const dif = (_date.getTime() - startDayOfFirstWeek.getTime()) / MS_PER_DAY;
|
|
12446
12509
|
if (dif < 0) {
|
|
@@ -12494,7 +12557,7 @@ const WORKDAY_INTL = {
|
|
|
12494
12557
|
timesHoliday.add(holiday.getTime());
|
|
12495
12558
|
});
|
|
12496
12559
|
}
|
|
12497
|
-
let stepDate =
|
|
12560
|
+
let stepDate = DateTime.fromTimestamp(_startDate.getTime());
|
|
12498
12561
|
let timeStepDate = stepDate.getTime();
|
|
12499
12562
|
const unitDay = Math.sign(_numDays);
|
|
12500
12563
|
let stepDay = Math.abs(_numDays);
|
|
@@ -12556,7 +12619,7 @@ const MONTH_START = {
|
|
|
12556
12619
|
const _startDate = toJsDate(date);
|
|
12557
12620
|
const yStart = _startDate.getFullYear();
|
|
12558
12621
|
const mStart = _startDate.getMonth();
|
|
12559
|
-
const jsDate = new
|
|
12622
|
+
const jsDate = new DateTime(yStart, mStart, 1);
|
|
12560
12623
|
return jsDateToRoundNumber(jsDate);
|
|
12561
12624
|
},
|
|
12562
12625
|
};
|
|
@@ -12594,7 +12657,7 @@ const QUARTER_START = {
|
|
|
12594
12657
|
compute: function (date) {
|
|
12595
12658
|
const quarter = QUARTER.compute(date);
|
|
12596
12659
|
const year = YEAR.compute(date);
|
|
12597
|
-
const jsDate = new
|
|
12660
|
+
const jsDate = new DateTime(year, (quarter - 1) * 3, 1);
|
|
12598
12661
|
return jsDateToRoundNumber(jsDate);
|
|
12599
12662
|
},
|
|
12600
12663
|
};
|
|
@@ -12609,7 +12672,7 @@ const QUARTER_END = {
|
|
|
12609
12672
|
compute: function (date) {
|
|
12610
12673
|
const quarter = QUARTER.compute(date);
|
|
12611
12674
|
const year = YEAR.compute(date);
|
|
12612
|
-
const jsDate = new
|
|
12675
|
+
const jsDate = new DateTime(year, quarter * 3, 0);
|
|
12613
12676
|
return jsDateToRoundNumber(jsDate);
|
|
12614
12677
|
},
|
|
12615
12678
|
};
|
|
@@ -12623,7 +12686,7 @@ const YEAR_START = {
|
|
|
12623
12686
|
computeFormat: () => "m/d/yyyy",
|
|
12624
12687
|
compute: function (date) {
|
|
12625
12688
|
const year = YEAR.compute(date);
|
|
12626
|
-
const jsDate = new
|
|
12689
|
+
const jsDate = new DateTime(year, 0, 1);
|
|
12627
12690
|
return jsDateToRoundNumber(jsDate);
|
|
12628
12691
|
},
|
|
12629
12692
|
};
|
|
@@ -12637,7 +12700,7 @@ const YEAR_END = {
|
|
|
12637
12700
|
computeFormat: () => "m/d/yyyy",
|
|
12638
12701
|
compute: function (date) {
|
|
12639
12702
|
const year = YEAR.compute(date);
|
|
12640
|
-
const jsDate = new
|
|
12703
|
+
const jsDate = new DateTime(year + 1, 0, 0);
|
|
12641
12704
|
return jsDateToRoundNumber(jsDate);
|
|
12642
12705
|
},
|
|
12643
12706
|
};
|
|
@@ -12684,8 +12747,8 @@ const DEFAULT_DELTA_ARG = 0;
|
|
|
12684
12747
|
const DELTA = {
|
|
12685
12748
|
description: _lt("Compare two numeric values, returning 1 if they're equal."),
|
|
12686
12749
|
args: [
|
|
12687
|
-
arg(" (number)", _lt("The first number to compare.")),
|
|
12688
|
-
arg(` (number, default=${DEFAULT_DELTA_ARG})`, _lt("The second number to compare.")),
|
|
12750
|
+
arg("number1 (number)", _lt("The first number to compare.")),
|
|
12751
|
+
arg(`number2 (number, default=${DEFAULT_DELTA_ARG})`, _lt("The second number to compare.")),
|
|
12689
12752
|
],
|
|
12690
12753
|
returns: ["NUMBER"],
|
|
12691
12754
|
compute: function (number1, number2 = DEFAULT_DELTA_ARG) {
|
|
@@ -12771,7 +12834,7 @@ function assertDeprecationFactorStrictlyPositive(factor) {
|
|
|
12771
12834
|
function assertSettlementLessThanOneYearBeforeMaturity(settlement, maturity) {
|
|
12772
12835
|
const startDate = toJsDate(settlement);
|
|
12773
12836
|
const endDate = toJsDate(maturity);
|
|
12774
|
-
const startDatePlusOneYear =
|
|
12837
|
+
const startDatePlusOneYear = toJsDate(settlement);
|
|
12775
12838
|
startDatePlusOneYear.setFullYear(startDate.getFullYear() + 1);
|
|
12776
12839
|
assert(() => endDate.getTime() <= startDatePlusOneYear.getTime(), _lt("The settlement date (%s) must at most one year after the maturity date (%s).", settlement.toString(), maturity.toString()));
|
|
12777
12840
|
}
|
|
@@ -12906,7 +12969,7 @@ const AMORLINC = {
|
|
|
12906
12969
|
arg("salvage (number)", _lt("The value of the asset at the end of depreciation.")),
|
|
12907
12970
|
arg("period (number)", _lt("The single period within life for which to calculate depreciation.")),
|
|
12908
12971
|
arg("rate (number)", _lt("The deprecation rate.")),
|
|
12909
|
-
arg(" (number, optional)", _lt("An indicator of what day count method to use.")),
|
|
12972
|
+
arg("day_count_convention (number, optional)", _lt("An indicator of what day count method to use.")),
|
|
12910
12973
|
],
|
|
12911
12974
|
returns: ["NUMBER"],
|
|
12912
12975
|
compute: function (cost, purchaseDate, firstPeriodEnd, salvage, period, rate, dayCountConvention = DEFAULT_DAY_COUNT_CONVENTION) {
|
|
@@ -15850,8 +15913,8 @@ const MID = {
|
|
|
15850
15913
|
description: _lt("A segment of a string."),
|
|
15851
15914
|
args: [
|
|
15852
15915
|
arg("text (string)", _lt("The string to extract a segment from.")),
|
|
15853
|
-
arg(" (number)", _lt("The index from the left of string from which to begin extracting. The first character in string has the index 1.")),
|
|
15854
|
-
arg(" (number)", _lt("The length of the segment to extract.")),
|
|
15916
|
+
arg("starting_at (number)", _lt("The index from the left of string from which to begin extracting. The first character in string has the index 1.")),
|
|
15917
|
+
arg("extract_length (number)", _lt("The length of the segment to extract.")),
|
|
15855
15918
|
],
|
|
15856
15919
|
returns: ["STRING"],
|
|
15857
15920
|
compute: function (text, starting_at, extract_length) {
|
|
@@ -45601,6 +45664,6 @@ exports.setTranslationMethod = setTranslationMethod;
|
|
|
45601
45664
|
exports.tokenize = tokenize;
|
|
45602
45665
|
|
|
45603
45666
|
|
|
45604
|
-
__info__.version = '16.2.
|
|
45605
|
-
__info__.date = '2024-01-
|
|
45606
|
-
__info__.hash = '
|
|
45667
|
+
__info__.version = '16.2.27';
|
|
45668
|
+
__info__.date = '2024-01-12T13:42:07.889Z';
|
|
45669
|
+
__info__.hash = 'd8b1d67';
|
package/dist/o-spreadsheet.d.ts
CHANGED
|
@@ -202,6 +202,33 @@ declare function toCartesian(xc: string): Position$1;
|
|
|
202
202
|
*/
|
|
203
203
|
declare function toXC(col: HeaderIndex, row: HeaderIndex, rangePart?: RangePart): string;
|
|
204
204
|
|
|
205
|
+
/**
|
|
206
|
+
* A DateTime object that can be used to manipulate spreadsheet dates.
|
|
207
|
+
* Conceptually, a spreadsheet date is simply a number with a date format,
|
|
208
|
+
* and it is timezone-agnostic.
|
|
209
|
+
* This DateTime object consistently uses UTC time to represent a naive date and time.
|
|
210
|
+
*/
|
|
211
|
+
declare class DateTime {
|
|
212
|
+
private jsDate;
|
|
213
|
+
constructor(year: number, month: number, day: number, hours?: number, minutes?: number, seconds?: number);
|
|
214
|
+
static fromTimestamp(timestamp: number): DateTime;
|
|
215
|
+
static now(): DateTime;
|
|
216
|
+
toString(): string;
|
|
217
|
+
getTime(): number;
|
|
218
|
+
getFullYear(): number;
|
|
219
|
+
getMonth(): number;
|
|
220
|
+
getDate(): number;
|
|
221
|
+
getDay(): number;
|
|
222
|
+
getHours(): number;
|
|
223
|
+
getMinutes(): number;
|
|
224
|
+
getSeconds(): number;
|
|
225
|
+
setFullYear(year: number): void;
|
|
226
|
+
setDate(date: number): void;
|
|
227
|
+
setHours(hours: number): void;
|
|
228
|
+
setMinutes(minutes: number): void;
|
|
229
|
+
setSeconds(seconds: number): void;
|
|
230
|
+
}
|
|
231
|
+
|
|
205
232
|
/**
|
|
206
233
|
* Formats a cell value with its format.
|
|
207
234
|
*/
|
|
@@ -6592,7 +6619,7 @@ declare class ChartPanel extends Component<Props, SpreadsheetChildEnv> {
|
|
|
6592
6619
|
declare function toNumber(value: string | number | boolean | null | undefined): number;
|
|
6593
6620
|
declare function toString(value: string | number | boolean | null | undefined): string;
|
|
6594
6621
|
declare function toBoolean(value: string | number | boolean | null | undefined): boolean;
|
|
6595
|
-
declare function toJsDate(value: string | number | boolean | null | undefined):
|
|
6622
|
+
declare function toJsDate(value: string | number | boolean | null | undefined): DateTime;
|
|
6596
6623
|
|
|
6597
6624
|
declare function arg(definition: string, description?: string): ArgDefinition;
|
|
6598
6625
|
|