Skip to content

📚 The open-source, offline-first Notion, Obsidian & Confluence alternative. Advanced Markdown, multi-tenant teams, OIDC/SSO, and local S3 backups. Deploy in one command.

Use exported dates functions to format date

Smaug6739006ea7c9abcb
diff --git a/frontend/app/components/DocumentCard.vue b/frontend/app/components/DocumentCard.vue
index 12a4ea7a..aa2be6a0 100644
--- a/frontend/app/components/DocumentCard.vue
+++ b/frontend/app/components/DocumentCard.vue
@@ -23,10 +23,10 @@
d="m612-292 56-56-148-148v-184h-80v216l172 172ZM480-80q-83 0-156-31.5T197-197q-54-54-85.5-127T80-480q0-83 31.5-156T197-763q54-54 127-85.5T480-880q83 0 156 31.5T763-763q54 54 85.5 127T880-480q0 83-31.5 156T763-197q-54 54-127 85.5T480-80Zm0-400Zm0 320q133 0 226.5-93.5T800-480q0-133-93.5-226.5T480-800q-133 0-226.5 93.5T160-480q0 133 93.5 226.5T480-160Z"
/>
</svg>
- <span>{{ formatDate(document.created_timestamp) }}</span>
+ <span>{{ shortDate(document.created_timestamp) }}</span>
</div>
<div class="footer-item">
- <span>Updated : {{ formatDate(document.updated_timestamp) }}</span>
+ <span>Updated : {{ shortDate(document.updated_timestamp) }}</span>
</div>
</footer>
</div>
diff --git a/frontend/app/components/DocumentLine.vue b/frontend/app/components/DocumentLine.vue
index 4abdeb8f..ae282c83 100644
--- a/frontend/app/components/DocumentLine.vue
+++ b/frontend/app/components/DocumentLine.vue
@@ -21,7 +21,7 @@
d="m612-292 56-56-148-148v-184h-80v216l172 172ZM480-80q-83 0-156-31.5T197-197q-54-54-85.5-127T80-480q0-83 31.5-156T197-763q54-54 127-85.5T480-880q83 0 156 31.5T763-763q54 54 85.5 127T880-480q0 83-31.5 156T763-197q-54 54-127 85.5T480-80Zm0-400Zm0 320q133 0 226.5-93.5T800-480q0-133-93.5-226.5T480-800q-133 0-226.5 93.5T160-480q0 133 93.5 226.5T480-160Z"
/>
</svg>
- <span class="date">{{ formatDate(document.updated_timestamp) }}</span>
+ <span class="date">{{ shortDate(document.updated_timestamp) }}</span>
</footer>
</div>
</template>
diff --git a/frontend/app/components/Kanban/KanbanCard.vue b/frontend/app/components/Kanban/KanbanCard.vue
index c2cd8c02..8416db5b 100644
--- a/frontend/app/components/Kanban/KanbanCard.vue
+++ b/frontend/app/components/Kanban/KanbanCard.vue
@@ -20,7 +20,7 @@
<div v-if="node.tags" class="card-tags">
<span v-for="tag in parsedTags" :key="tag" class="tag">{{ tag }}</span>
</div>
- <span class="card-date">{{ formatDate(node.updated_timestamp) }}</span>
+ <span class="card-date">{{ shortDate(node.updated_timestamp) }}</span>
</div>
</div>
</template>
diff --git a/frontend/app/components/Node/NodeContextMenu.vue b/frontend/app/components/Node/NodeContextMenu.vue
index a1d745d4..f1e0c8d9 100644
--- a/frontend/app/components/Node/NodeContextMenu.vue
+++ b/frontend/app/components/Node/NodeContextMenu.vue
@@ -4,7 +4,7 @@
<img :src="useAvatar(user)" alt="" class="header-avatar" />
<div class="header-info">
<span class="header-name">{{ node.name }}</span>
- <span class="header-meta">{{ user?.username }} · {{ formatDate(node.updated_timestamp) }}</span>
+ <span class="header-meta">{{ user?.username }} · {{ shortDate(node.updated_timestamp) }}</span>
</div>
</div>
diff --git a/frontend/app/composables/formatters.ts b/frontend/app/composables/formatters.ts
index 62b563c9..6eac83f8 100644
--- a/frontend/app/composables/formatters.ts
+++ b/frontend/app/composables/formatters.ts
@@ -1,7 +1,7 @@
const locale = 'en-US';
/** Format a timestamp to a readable date string (e.g., "15 Dec 2024") */
-export function formatDate(timestamp: number | undefined): string {
+export function shortDate(timestamp: number | undefined): string {
const date = new Date(timestamp || 0);
return `${date.getDate()} ${date.toLocaleString('default', { month: 'short' })} ${date.getFullYear()}`;
}
@@ -28,7 +28,7 @@ export const relativeTime = (timestamp: number) => {
if (hours < 24) return `${hours}h ago`;
if (days === 1) return 'Yesterday';
if (days < 7) return `${days} days ago`;
- return formatDate(timestamp);
+ return shortDate(timestamp);
};
export const formatRelativeDate = (timestamp?: number) => {
@@ -43,7 +43,7 @@ export const formatRelativeDate = (timestamp?: number) => {
return new Date(timestamp).toLocaleDateString('en-US', { month: 'short', day: 'numeric', year: 'numeric' });
};
-export const formatDateLabel = (timestamp: number) => {
+export const shortDateLabel = (timestamp: number) => {
const date = new Date(timestamp);
const today = new Date();
const yesterday = new Date(today);
diff --git a/frontend/app/pages/dashboard/admin/users/[id]/documents/index.vue b/frontend/app/pages/dashboard/admin/users/[id]/documents/index.vue
index 8617aff7..8b5434bc 100644
--- a/frontend/app/pages/dashboard/admin/users/[id]/documents/index.vue
+++ b/frontend/app/pages/dashboard/admin/users/[id]/documents/index.vue
@@ -53,7 +53,7 @@ const rows = computed(() =>
name: { content: doc.name, type: 'text' as const },
category: { content: categoriesStore.getById(doc.parent_id || '')?.name || '', type: 'text' as const },
tags: { content: stringToBadge(doc.tags), type: 'html' as const },
- last_update: { content: new Date(doc.updated_timestamp).toLocaleDateString(), type: 'text' as const },
+ last_update: { content: numericDate(doc.updated_timestamp), type: 'text' as const },
attributes: { content: badges, type: 'html' as const },
actions: { type: 'slot' as const, data: { id: doc.id } },
};
diff --git a/frontend/app/pages/dashboard/admin/users/[id]/index.vue b/frontend/app/pages/dashboard/admin/users/[id]/index.vue
index 189a5e82..a27a51d2 100644
--- a/frontend/app/pages/dashboard/admin/users/[id]/index.vue
+++ b/frontend/app/pages/dashboard/admin/users/[id]/index.vue
@@ -31,11 +31,11 @@
<div style="display: flex; width: 100%">
<div class="user-detail">
<label>Created At</label>
- <div class="value">{{ new Date(user.created_timestamp).toLocaleDateString() }}</div>
+ <div class="value">{{ numericDate(user.created_timestamp) }}</div>
</div>
<div class="user-detail">
<label>Updated At</label>
- <div class="value">{{ new Date(user.updated_timestamp || 0).toLocaleDateString() }}</div>
+ <div class="value">{{ numericDate(user.updated_timestamp) }}</div>
</div>
</div>
</div>
diff --git a/frontend/app/pages/dashboard/admin/users/index.vue b/frontend/app/pages/dashboard/admin/users/index.vue
index 9c03cb86..cb6451c1 100644
--- a/frontend/app/pages/dashboard/admin/users/index.vue
+++ b/frontend/app/pages/dashboard/admin/users/index.vue
@@ -39,7 +39,7 @@ const rows = computed(() =>
lastname: { content: u.lastname, type: 'text' as const },
email: { content: u.email, type: 'text' as const },
role: { content: u.role == 2 ? `<tag class="red">Admin</tag>` : `<tag class="blue">User</tag>`, type: 'html' as const },
- created_at: { content: new Date(u.created_timestamp).toLocaleDateString(), type: 'text' as const },
+ created_at: { content: numericDate(u.created_timestamp), type: 'text' as const },
action: { type: 'slot' as const, data: { id: u.id } },
};
}),
diff --git a/frontend/app/pages/dashboard/cdn/index.vue b/frontend/app/pages/dashboard/cdn/index.vue
index e2e13bda..d1ffd316 100644
--- a/frontend/app/pages/dashboard/cdn/index.vue
+++ b/frontend/app/pages/dashboard/cdn/index.vue
@@ -163,7 +163,7 @@ const rows: ComputedRef<Field[]> = computed(() =>
size: { content: readableFileSize(res.size ?? 0), type: 'text' },
type: { content: `<tag class="${color(res.metadata?.filetype as string)}">${res.metadata?.filetype as string}</tag>`, type: 'html' },
parent: { content: category ? `<tag class="${getAppColor(category.color)}">${parent?.name}</tag>` : '', type: 'html' },
- date: { content: new Date(res.created_timestamp).toLocaleDateString(), type: 'text' },
+ date: { content: numericDate(res.created_timestamp), type: 'text' },
action: { type: 'slot', data: res },
};
}),
diff --git a/frontend/app/pages/dashboard/home.vue b/frontend/app/pages/dashboard/home.vue
index e2633d50..fe520af4 100644
--- a/frontend/app/pages/dashboard/home.vue
+++ b/frontend/app/pages/dashboard/home.vue
@@ -191,7 +191,7 @@ const activityByDate = computed(() => {
const groups: Record<string, Node[]> = {};
docs.forEach(doc => {
- const date = formatDateLabel(doc.updated_timestamp);
+ const date = shortDateLabel(doc.updated_timestamp);
if (!groups[date]) groups[date] = [];
groups[date].push(doc);
});
diff --git a/frontend/app/pages/dashboard/import.vue b/frontend/app/pages/dashboard/import.vue
index a7abaf2e..237ca3d7 100644
--- a/frontend/app/pages/dashboard/import.vue
+++ b/frontend/app/pages/dashboard/import.vue
@@ -21,8 +21,8 @@
<tag v-for="tag in file.tags?.split(',')" :key="tag" class="blue">{{ tag.trim() }}</tag>
</div>
</div>
- <p>Created at: {{ new Date(file.created_timestamp).toLocaleDateString() }}</p>
- <p>Updated at: {{ new Date(file.updated_timestamp).toLocaleDateString() }}</p>
+ <p>Created at: {{ numericDate(file.created_timestamp) }}</p>
+ <p>Updated at: {{ numericDate(file.updated_timestamp) }}</p>
<AppButton type="success" @click="importDoc(file)">Import single</AppButton>
</div>
<p style="display: flex; justify-content: flex-end">
diff --git a/frontend/app/pages/dashboard/settings/_views/profile.vue b/frontend/app/pages/dashboard/settings/_views/profile.vue
index a0387b32..1922c23c 100644
--- a/frontend/app/pages/dashboard/settings/_views/profile.vue
+++ b/frontend/app/pages/dashboard/settings/_views/profile.vue
@@ -27,8 +27,8 @@
<AppButton type="primary">Update profile</AppButton>
</form>
<hr style="margin: 10px 0" />
- <p><strong>Account creation:</strong> {{ formatDate(userStore.user?.created_timestamp) }}</p>
- <p><strong>Last update:</strong> {{ formatDate(userStore.user?.updated_timestamp) }}</p>
+ <p><strong>Account creation:</strong> {{ shortDate(userStore.user?.created_timestamp) }}</p>
+ <p><strong>Last update:</strong> {{ shortDate(userStore.user?.updated_timestamp) }}</p>
</div>
</template>
diff --git a/frontend/app/pages/dashboard/settings/_views/security.vue b/frontend/app/pages/dashboard/settings/_views/security.vue
index 30b35e3b..214e9887 100644
--- a/frontend/app/pages/dashboard/settings/_views/security.vue
+++ b/frontend/app/pages/dashboard/settings/_views/security.vue
@@ -30,7 +30,7 @@
<path fill="var(--cl-screen, #111111)" fill-rule="evenodd" d="M579.7 89.5h63v39.4h-63V89.5Z" clip-rule="evenodd" />
</svg>
<div>
- <p><strong>Last connection:</strong> {{ new Date(store.last_connection.timestamp).toLocaleString() }}</p>
+ <p><strong>Last connection:</strong> {{ numericDate(store.last_connection.timestamp) }}</p>
<p><strong>IP:</strong> {{ store.last_connection.ip_adress }} ({{ store.last_connection.location }})</p>
<p><strong>Browser:</strong> {{ parseUserAgent(store.last_connection.user_agent).browser }}</p>
<p><strong>OS:</strong> {{ parseUserAgent(store.last_connection.user_agent).os }}</p>