Skip to content

Commit

Permalink
Merge branch 'develop' into address-key-content-changes
Browse files Browse the repository at this point in the history
  • Loading branch information
BrianHung authored Aug 2, 2023
2 parents d68c8d1 + 2b8e92e commit fd04722
Showing 1 changed file with 20 additions and 2 deletions.
22 changes: 20 additions & 2 deletions test/interpreter/function-day.spec.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import {HyperFormula} from '../../src'
import {ErrorType} from '../../src/Cell'
import {HyperFormula, ErrorType} from '../../src'
import {ErrorMessage} from '../../src/error-message'
import {adr, detailedError} from '../testUtils'

Expand Down Expand Up @@ -226,4 +225,23 @@ describe('Function DAY', () => {
expect(engine.getCellValue(adr('A11'))).toEqual(1)
expect(engine.getCellValue(adr('A12'))).toEqual(1)
})

it('returns 30 when its argument is a reference to an empty cell', () => {
const engine = HyperFormula.buildFromArray([
['=DAY(B1)'],
])

expect(engine.getCellValue(adr('A1'))).toEqual(30)
})

it('returns 31 when its argument is a reference to an empty cell and the engine is configured to use 1899-12-31 as a null year', () => {
const engine = HyperFormula.buildFromArray([
['=DAY(B1)'],
], {
leapYear1900: true,
nullDate: { year: 1899, month: 12, day: 31 },
})

expect(engine.getCellValue(adr('A1'))).toEqual(31)
})
})

0 comments on commit fd04722

Please sign in to comment.