最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - timezone-mock gives 'Unhandled type passed to MockDate Constructor: object' when using ContextOptio

programmeradmin3浏览0评论

Here's the code to reproduce it:

import timezoneMock from 'timezone-mock';
import { utc } from '@date-fns/utc';

it('breaks', () => {
  timezoneMock.register('US/Eastern')
  const now = new Date();
  expect(isSameDay(now, now, { in: utc })).toBeTrue;
  timezoneMock.unregister();
});

I think deep in the bowls of either date-fns or ttimezoneMock, it's passing UTCDate through, and not the mocked date. But I can't be sure unfortunately.

Have I used isSameDay or timezoneMock wrong?

If not I'll raise this as a bug on a backlog somewhere?

与本文相关的文章

发布评论

评论列表(0)

  1. 暂无评论