Skip superfluous conversion to Date in ft-list-video #5123
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Skip superfluous conversion to Date in ft-list-video
Pull Request Type
Description
Inside
ft-list-video
we create aDate
object from thepublished
timestamp number before passing it togetRelativeTimeFromDate
but in that function it only gets used in some arithmetic, so gets immediately converted back into a number by JavaScript (thedate
variable):FreeTube/src/renderer/helpers/utils.js
Lines 748 to 756 in b9d5778
We also know that it will always be a number because it's typechecked just a few lines above:
FreeTube/src/renderer/components/ft-list-video/ft-list-video.js
Lines 666 to 674 in b9d5778
TL;DR it's a number and we use it as a number, so we don't need the conversion to a
Date
object and back.Testing
Open a video list e.g. the subscriptions and check that the relative published dates show up correctly.
Desktop