MCPcopy
hub / github.com/exceljs/exceljs / assertDate

Function assertDate

test/testCsvIn.js:28–62  ·  view source on GitHub ↗
(address, cell, expected)

Source from the content-addressed store, hash-verified

26// };
27
28const assertDate = function(address, cell, expected) {
29 assert(
30 cell.type === Excel.ValueType.Date,
31 `expected ${address} type to be Date, was ${cell.type}`
32 );
33 assert(
34 cell.value instanceof Date,
35 `expected value ${address} to be a Date, was ${cell.value}`
36 );
37 const {value} = cell;
38 assert(
39 value.getYear() === expected.getYear(),
40 `expected ${address} Year to be ${expected.getYear()}, was ${value.getYear()}`
41 );
42 assert(
43 value.getMonth() === expected.getMonth(),
44 `expected ${address} Month to be ${expected.getMonth()}, was ${value.getMonth()}`
45 );
46 assert(
47 value.getDay() === expected.getDay(),
48 `expected ${address} Day to be ${expected.getDay()}, was ${value.getDay()}`
49 );
50 assert(
51 value.getHours() === expected.getHours(),
52 `expected ${address} Hour to be ${expected.getHours()}, was ${value.getHours()}`
53 );
54 assert(
55 value.getMinutes() === expected.getMinutes(),
56 `expected ${address} Minute to be ${expected.getMinutes()}, was ${value.getMinutes()}`
57 );
58 assert(
59 value.getSeconds() === expected.getSeconds(),
60 `expected ${address} Second to be ${expected.getSeconds()}, was ${value.getSeconds()}`
61 );
62};
63
64const options = {
65 dateFormats: ['DD/MM/YYYY HH:mm:ss'],

Callers 1

testCsvIn.jsFile · 0.85

Calls 1

assertFunction · 0.70

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…