Better date fomatting in the views.
Using the 'formatRelative' method to show better human readable dates.
Details
- Reviewers
- None
- Group Reviewers
Reviewers
Diff Detail
- Repository
- rDWAPPS Web applications
- Branch
- momentjs
- Lint
No Linters Available - Unit
No Unit Test Coverage - Build Status
Buildable 27833 Build 43571: Phabricator diff pipeline on jenkins Jenkins console · Jenkins Build 43570: arc lint + arc unit
Event Timeline
Build has FAILED
Patch application report for D7434 (id=26904)
Rebasing onto cdda03c3aa...
Current branch diff-target is up to date.
Changes applied before test
commit f7498fe59d9872028f008d1fd9c368d75e50be60 Author: Jayesh Velayudhan <jayesh@softwareheritage.org> Date: Fri Mar 25 15:15:47 2022 +0100 Add date-fns for better date formatting in JS Better date fomatting in the views. Using the 'formatRelative' method to show better human readable dates.
Link to build: https://jenkins.softwareheritage.org/job/DWAPPS/job/tests-on-diff/1585/
See console output for more information: https://jenkins.softwareheritage.org/job/DWAPPS/job/tests-on-diff/1585/console
Not just about showing relative date.
Since we are showing dates in many pages, isn't it better to have a better formatting library?
This lib seems to be powerful and well maintained.
https://date-fns.org/
Build is green
Patch application report for D7434 (id=26916)
Rebasing onto 6f1a974c1f...
First, rewinding head to replay your work on top of it... Applying: Add date-fns for better date formatting in JS
Changes applied before test
commit 0156b32ec462f204af17c4a340f266f53182fb47 Author: Jayesh Velayudhan <jayesh@softwareheritage.org> Date: Fri Mar 25 16:11:27 2022 +0100 Add date-fns for better date formatting in JS Better date fomatting in the views. Using the 'formatRelative' method to show better human readable dates.
See https://jenkins.softwareheritage.org/job/DWAPPS/job/tests-on-diff/1589/ for more details.
Since we are showing dates in many pages, isn't it better to have a better formatting library?
We already have quite a lot of js dependencies, adding a new one just for displaying a relative date seems overkill to me.
I still prefer to have the full date displayed, this is more informative and does not require to do computation in your head
to get back to the original date.
Also apart the date displayed in the datatables, other ones displayed in the webapp are formatted by django template filters
which outputs a format similar to Date.toLocaleString.