Open nuvious opened 2 weeks ago
Thank you for opening your first issue in this project! Engagement like this is essential for open source projects! :hugs:
If you haven't done so already, check out Jupyter's Code of Conduct. Also, please try to follow the issue template as it helps other other community members to contribute more effectively.
You can meet the other Jovyans by joining our Discourse forum. There is also an intro thread there where you can stop by and say Hi! :wave:
Welcome to the Jupyter community! :tada:
Description
Last Modified date shows "next year" for new notebooks and existing notebooks soon after being saved, especially while under a heavy processing load.
Reproduce
Diagnosed and narrowed the issue down to
Time.formatHuman
function injupyter/jupyterlab/packages/coreutils/src/time.ts
. If you set a breakpoint afterdelta
is calculated it is sometimes a positive value. My guess is this is due to some asynchronous execution resulting in the save time appearing before the Date.now() time.With
delta
(s
) being a positive value, the result ofMath.ceil(delta / unit.milliseconds)
for any of the units will be 1. The first unit in the list is{ name: 'years', milliseconds: 365 * 24 * 60 * 60 * 1000 }
and thus with amount being non-zeroreturn formatter.format(amount, unit.name);
on line 57 has the values 1, "year" and is formatted to "next year".A simple check to see if s is positive and return
formatter.format(0, 'seconds');
if it is will resolve the issue and a PR is to follow submitted by me; just wanted to get the issue documented first.Expected behavior
Expect it to show "0 seconds" or "now" or whatever makes sense based on notebook language settings.
Context
Troubleshoot Output
Command Line Output
Browser Output