push
github
4327 of 4526 branches covered (95.6%)
278 of 309 new or added lines in 14 files covered. (89.97%)
28532 of 34767 relevant lines covered (82.07%)
1263.95 hits per line
1 |
import { DateFieldCore } from '@teable/core'; |
4✔ |
2 |
import type { FieldBase } from '../field-base'; |
4✔ |
3 |
|
4✔ |
4 |
export class DateFieldDto extends DateFieldCore implements FieldBase { |
4✔ |
5 |
get isStructuredCellValue() { |
4✔ |
6 |
return false; |
× |
7 |
} |
× |
8 |
|
4✔ |
9 |
convertCellValue2DBValue(value: unknown): unknown { |
|
10 |
if (this.isMultipleCellValue) { |
|
11 |
return value == null ? value : JSON.stringify(value);
|
|
12 |
} |
|
13 |
return value;
|
328✔ |
14 |
} |
328✔ |
15 |
|
4✔ |
16 |
convertDBValue2CellValue(value: unknown): unknown { |
|
17 |
if (this.isMultipleCellValue) { |
|
18 |
return value == null || typeof value === 'object' ? value : JSON.parse(value as string); |
|
19 |
} |
|
20 |
if (value instanceof Date) {
|
|
21 |
return value.toISOString();
|
4,034✔ |
22 |
} |
|
|
|
1,316✔ |
|
if (typeof value === 'string' || typeof value === 'number') { |
|
NEW
|
return new Date(value).toISOString(); |
× |
NEW
|
} |
|
|
|
1,316✔ |
28 |
return value;
|
1,316✔ |
29 |
} |
1,316✔ |
30 |
} |
4✔ |