Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,8 @@ const TEST_WORKBOOK_DATA: IWorkbookData = {
sheet1: {
id: 'sheet1',
name: 'Main',
rowCount: 5,
columnCount: 5,
cellData: {
0: {
0: {
Expand Down Expand Up @@ -141,6 +143,12 @@ const TEST_WORKBOOK_DATA: IWorkbookData = {
t: CellValueType.NUMBER,
},
},
4: {
0: {
v: '2025-01-01',
t: CellValueType.STRING,
},
},
},
},
sheet2: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ import { ErrorType } from '../../../basics/error-type';
import { FUNCTION_NAMES_MATH } from '../../../functions/math/function-names';
import { Pi } from '../../../functions/math/pi';
import { Sum } from '../../../functions/math/sum';
import { Compare } from '../../../functions/meta/compare';
import { Divided } from '../../../functions/meta/divided';
import { FUNCTION_NAMES_META } from '../../../functions/meta/function-names';
import { Minus } from '../../../functions/meta/minus';
Expand Down Expand Up @@ -94,6 +95,7 @@ describe('Test indirect', () => {
new Plus(FUNCTION_NAMES_META.PLUS),
new Minus(FUNCTION_NAMES_META.MINUS),
new Divided(FUNCTION_NAMES_META.DIVIDED),
new Compare(FUNCTION_NAMES_META.COMPARE),
new Pi(FUNCTION_NAMES_MATH.PI),
new Countif(FUNCTION_NAMES_STATISTICAL.COUNTIF)
);
Expand Down Expand Up @@ -176,6 +178,16 @@ describe('Test indirect', () => {
expect((result as ArrayValueObject).getFirstCell().getValue()).toStrictEqual(1);
});

it('should compare quoted date literals as strings', async () => {
const lexerNode = lexer.treeBuilder('=A5>="2026-01-01"');

const astNode = astTreeBuilder.parse(lexerNode as LexerNode);

const result = interpreter.execute(generateExecuteAstNodeData(astNode as BaseAstNode));

expect((result as ArrayValueObject).getFirstCell().getValue()).toBe(false);
});

it('Minus Minus Minus ref', async () => {
const lexerNode = lexer.treeBuilder('=---A1');

Expand Down
6 changes: 4 additions & 2 deletions 6 packages/engine-formula/src/engine/utils/numfmt-kit.ts
Original file line number Diff line number Diff line change
Expand Up @@ -336,10 +336,12 @@ const stringToNumberPatternCache = new FormulaAstLRU<{
}>(100000);

export function stringIsNumberPattern(input: string) {
let _input = input;
const _input = input;

if (_input.startsWith('"') && _input.endsWith('"')) {
_input = _input.slice(1, -1);
return {
isNumberPattern: false,
};
}

const cacheValue = stringToNumberPatternCache.get(_input);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -426,6 +426,11 @@ describe('arrayValueObject test', () => {
stringValueObject = ValueObjectFactory.create(' ');

expect(stringValueObject.isString()).toBeTruthy();

stringValueObject = ValueObjectFactory.create('"2026-01-01"');

expect(stringValueObject.isString()).toBeTruthy();
expect(stringValueObject.getValue()).toBe('2026-01-01');
});

it('ValueObjectFactory create ErrorValueObject ', () => {
Expand Down
Loading
Morty Proxy This is a proxified and sanitized view of the page, visit original site.