sindresorhus/refined-github

Repository age shown as `NaN undefined old` after first opening repo #2603

maxmclau posted onGitHub

Opening a repository for the first time it'll properly display the creation date. Refreshing the page results in NaN undefined old.

<img width="889" alt="Screen Shot 2019-12-06 at 2 21 05 PM" src="https://user-images.githubusercontent.com/3848317/70357239-a93d7f80-1833-11ea-97df-26cc52bd50b9.png">

The issue is in the timeAgo() function. For some reason, it returns null values after a refresh. It feels like a caching issue, but caching of this value hasn't yet been implemented.

// source/libs/time-ago.tsx

const time = (<time-ago datetime={date.toISOString()} format="micro"/>).textContent!;

time will just return a blank string after being fetched once. I played around with it, but I'm stumped. This is effecting the current release.


It might be worth investigating (on the non-cached version) whether it’s the custom element’s fault or if for some reason the creation date string is wrong

posted by fregante over 5 years ago

I can't reproduce and this never seems to fail in the console either:

t = document.createElement('time-ago');
t.setAttribute('datetime', new Date().toISOString());
t.setAttribute('format', 'micro');
t.textContent // '1m'
posted by fregante over 5 years ago

I'm pretty sure I had this just one or two days ago. Not sure though.

posted by loilo over 5 years ago

Fund this Issue

$0.00
Funded

Pull requests