New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Date shows "next year" when creating or saving a notebook #16254
Comments
Thank you for opening your first issue in this project! Engagement like this is essential for open source projects! 🤗 |
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 sometimesa 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 unitswill be 1. The first unit in the list is
{ name: 'years', milliseconds: 365 * 24 * 60 * 60 * 1000 }
and thus withamount being non-zero
return formatter.format(amount, unit.name);
on line 57 has the values 1, "year" and is formattedto "next year".
A simple check to see if s is positive and return
formatter.format(0, 'seconds');
if it is will resolve the issue anda 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
The text was updated successfully, but these errors were encountered: