about summary refs log tree commit diff
path: root/src/components/forms
diff options
context:
space:
mode:
authorEric Bailey <git@esb.lol>2024-06-18 10:55:02 -0500
committerGitHub <noreply@github.com>2024-06-18 10:55:02 -0500
commit443beda74190b5af3083625116e9a9fdd4aa0fe0 (patch)
treeda09e78eccc720239155bd65ba0ddd53bd4cd22f /src/components/forms
parent08cfb0958907408933982ece4a16d59625b423b0 (diff)
downloadvoidsky-443beda74190b5af3083625116e9a9fdd4aa0fe0.tar.zst
Add `useGetTimeAgo` and utils (#4556)
* Create a testable version of ago() and re-enable the disabled test (#4364)

* Enable the test of ago()

* Use test cases

This puts the input and the expected values next to each other.

* Create dateDiff function

This is a copy of ago(), but with the ability to specify the second date instead of using Date.now().

* Let ago() use dateDiff()

* Move constants close to usage

* Test dateDiff instead of ago

This makes it possible to test the dates without being forced to rely on what the current date is.

The commented out tests do not yet pass. This is fixed in later commits.

* Update dateDiff and enable the remaining tests

* Split up tests, use date-fns as helpers

* Remove old test

* Add long format

* Add hook

* Migrate to hooks

* Delete old code

* Or equal to

* Update comment

---------

Co-authored-by: Jan Aagaard <jan@aagaard.net>
Diffstat (limited to 'src/components/forms')
0 files changed, 0 insertions, 0 deletions