google / osv.dev

Open source vulnerability DB and triage service.
https://osv.dev
Apache License 2.0
1.45k stars 173 forks source link

Remove relative-time lib to improve CLS #2350

Closed zahraaalizadeh closed 3 days ago

zahraaalizadeh commented 4 days ago

issue: https://github.com/google/osv.dev/issues/1013

Currently, we use relative-time package to convert timestamp to a human readable relative time, when displaying published time of the bug in the list page.

Using this approach is not optimised as it changes the texts in the loading time and leads to CLS issues.

This change replaces relative-time lib in favour of a new template tag which converts the published to a human readable relative time using a utility function.

Before:

Screenshot 2024-06-26 at 5 33 14 PM

After:

Screenshot 2024-06-26 at 6 29 22 PM