Skip to content

Commit 1e96958

Browse files
committed
fix: update date constructor in getTimeForFilename tests to avoid timezone issues
1 parent f2f3fd9 commit 1e96958

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

src/test/unit/dateHelpers.test.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -91,13 +91,14 @@ describe('Date Helpers', () => {
9191

9292
describe('getTimeForFilename', () => {
9393
it('should return time in 24-hour HHMM format without colon', () => {
94-
const morning = new Date('2024-10-15T09:30:00');
94+
// Use Date constructor with explicit values to avoid timezone issues
95+
const morning = new Date(2024, 9, 15, 9, 30, 0);
9596
expect(getTimeForFilename(morning)).to.equal('0930');
9697

97-
const afternoon = new Date('2024-10-15T14:45:00');
98+
const afternoon = new Date(2024, 9, 15, 14, 45, 0);
9899
expect(getTimeForFilename(afternoon)).to.equal('1445');
99100

100-
const midnight = new Date('2024-10-15T00:00:00');
101+
const midnight = new Date(2024, 9, 15, 0, 0, 0);
101102
expect(getTimeForFilename(midnight)).to.equal('0000');
102103
});
103104
});

0 commit comments

Comments
 (0)