Skip to content
This repository was archived by the owner on Feb 26, 2024. It is now read-only.

Commit c378f87

Browse files
JiaLiPassionvikerman
authored andcommitted
feat: add an option __zone_symbol__disableDatePatching to allow disable patching global.Date (#1203)
1 parent a5fe09b commit c378f87

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

Diff for: lib/zone-spec/fake-async-test.ts

+9
Original file line numberDiff line numberDiff line change
@@ -346,6 +346,15 @@ class FakeAsyncTestZoneSpec implements ZoneSpec {
346346
}
347347

348348
static patchDate() {
349+
if (!!global[Zone.__symbol__('disableDatePatching')]) {
350+
// we don't want to patch global Date
351+
// because in some case, global Date
352+
// is already being patched, we need to provide
353+
// an option to let user still use their
354+
// own version of Date.
355+
return;
356+
}
357+
349358
if (global['Date'] === FakeDate) {
350359
// already patched
351360
return;

0 commit comments

Comments
 (0)