We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 4fc855a commit 3907f7eCopy full SHA for 3907f7e
1 file changed
lib/cache.test.ts
@@ -402,6 +402,20 @@ describe('TTLCache', () => {
402
expect(cache.get('tags')).toEqual(tags);
403
cache.destroy();
404
});
405
+ it('preserves Date instance values in TTLCache', () => {
406
+ const cache = new TTLCache<Date>();
407
+
408
+ const date = new Date('2026-05-31T00:00:00.000Z');
409
410
+ cache.set('created-at', date, 60_000);
411
412
+ const cached = cache.get('created-at');
413
414
+ expect(cached).toBeInstanceOf(Date);
415
+ expect(cached?.toISOString()).toBe(date.toISOString());
416
417
+ cache.destroy();
418
+ });
419
420
it('stores and retrieves nested object values', () => {
421
const cache = new TTLCache<{
0 commit comments