about summary refs log tree commit diff
path: root/src/lib/hooks/useTimeAgo.ts
Commit message (Collapse)AuthorAgeFilesLines
* Add plural formatting for months in narrow form (#7744)surfdude292025-02-241-1/+1
|
* [APP-1049] show label expiration in frontend (#7738)Eric Bailey2025-02-181-7/+20
| | | | | | | | | | | | | * Add support for label exp to LabelsOnMeDialog * Add exp to PostAlerts, align with LabelsOnMe UI * Bump weight * Improve translations * Expiry should round up * Add a little visual alignment hack
* Localize dates, counts (#5027)Eric Bailey2024-08-291-50/+142
| | | | | | | | | | | | | | | | | | | | | | | * refactor: consistent localized formatting * refactor: localized date time * refactor: localize relative time with strings * chore: fix typo from copy-paste * Clean up useTimeAgo * Remove old ago * Const * Reuse * Prettier --------- Co-authored-by: Mary <git@mary.my.id>
* Force callers of `getTimeAgo` to pass in the value for "now" (#4560)Eric Bailey2024-06-181-13/+4
| | | | | | | * Remove icky hook for now * Force callers of getTimeAgo to pass in the 'now' value * Update usage in Newskie dialog
* Add `useGetTimeAgo` and utils (#4556)Eric Bailey2024-06-181-0/+95
* 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>