Compare commits

...

5 Commits

Author SHA1 Message Date
Abhinav Raut
3d76cce66a Merge pull request #151 from csr4422/enhancement/relative-time-months
Add month support to getRelativeTime
2025-10-03 13:39:14 +05:30
csr4422
4b8f30184a style: adjust spacing 2025-10-03 13:09:00 +05:30
csr4422
e4018ddab8 Add month support to getRelativeTime 2025-10-01 16:22:02 +05:30
Abhinav Raut
02e8a43587 Update README.md 2025-09-30 14:45:51 +05:30
Abhinav Raut
f3acc37405 update version to 0.8.0-beta in package.json
remove caution note about alpha status from README.md
2025-09-30 14:35:53 +05:30
3 changed files with 5 additions and 10 deletions

View File

@@ -10,8 +10,6 @@ Modern, open source, self-hosted customer support desk. Single binary app.
Visit [libredesk.io](https://libredesk.io) for more info. Check out the [**Live demo**](https://demo.libredesk.io/).
> **CAUTION:** This project is currently in **alpha**. Features and APIs may change and are not yet fully tested.
## Features
- **Multi Shared Inbox**
@@ -85,11 +83,6 @@ __________________
## Developers
If you are interested in contributing, refer to the [developer setup](https://docs.libredesk.io/contributing/developer-setup). The backend is written in Go and the frontend is Vue js 3 with Shadcn for UI components.
## Development Status
Libredesk is under active development.
Track roadmap and progress on the GitHub Project Board: [https://github.com/users/abhinavxd/projects/1](https://github.com/users/abhinavxd/projects/1)
## Translators
You can help translate Libredesk into your language on [Crowdin](https://crowdin.com/project/libredesk).

View File

@@ -1,6 +1,6 @@
{
"name": "libredesk",
"version": "0.6.0-alpha",
"version": "0.8.0-beta",
"private": true,
"type": "module",
"scripts": {

View File

@@ -1,16 +1,18 @@
import { format, differenceInMinutes, differenceInHours, differenceInDays, differenceInYears } from 'date-fns'
import { format, differenceInMinutes, differenceInHours, differenceInDays, differenceInMonths, differenceInYears } from 'date-fns'
export function getRelativeTime (timestamp, now = new Date()) {
try {
const mins = differenceInMinutes(now, timestamp)
const hours = differenceInHours(now, timestamp)
const days = differenceInDays(now, timestamp)
const months = differenceInMonths(now, timestamp)
const years = differenceInYears(now, timestamp)
if (mins === 0) return 'now'
if (mins < 60) return `${mins}m`
if (hours < 24) return `${hours}h`
if (days < 365) return `${days}d`
if (days < 31) return `${days}d`
if (months < 12) return `${months}mo`
return `${years}y`
} catch (error) {
console.error('Error parsing time', error, 'timestamp', timestamp)