-
Notifications
You must be signed in to change notification settings - Fork 294
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Remove moment from extension bundles (#12685)
* Remove moment from bundle * oops
- Loading branch information
1 parent
91f7e06
commit c1ad6a9
Showing
4 changed files
with
64 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
// Copyright (c) Microsoft Corporation. | ||
// Licensed under the MIT License. | ||
|
||
// This file has been handcrafted to override the use of moment.js. | ||
// Moment is only used in @jupyterlab/coreutils/lib/time.js | ||
// & that code is not used anywhere in any code path. | ||
// Hence we create a dummy moment object that does nothing. | ||
// & we have checks on CI that ensures no other npm package or other code does not in-directly or directly use moment. | ||
|
||
export default function (dateTime) { | ||
return { | ||
formatNow: () => { | ||
try { | ||
return dateTime.toLocaleString(); | ||
} catch { | ||
return `${dateTime}`; | ||
} | ||
}, | ||
format: () => { | ||
try { | ||
return dateTime.toLocaleTimeString(); | ||
} catch { | ||
return `${dateTime}`; | ||
} | ||
} | ||
}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters