1 parent
d90ece1a76
commit
346d89f7cc
4 files changed
+23
-2
No files matched your search
@@ -26,11 +26,19 @@
|
|||||||
|
|
||||||
let language = locale ?? 'en'
|
let language = locale ?? 'en'
|
||||||
|
|
||||||
|
if (settings.absoluteDates) {
|
||||||
|
const rtf = new Intl.DateTimeFormat(language, {
|
||||||
|
...options,
|
||||||
|
timeStyle: 'short',
|
||||||
|
dateStyle: 'short',
|
||||||
|
})
|
||||||
|
return rtf.format(date)
|
||||||
|
} else {
|
||||||
const rtf = new Intl.RelativeTimeFormat(language, options)
|
const rtf = new Intl.RelativeTimeFormat(language, options)
|
||||||
|
|
||||||
return rtf.format(-value, thresholds[i].unit as 'second')
|
return rtf.format(-value, thresholds[i].unit as 'second')
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
return 'Now'
|
return 'Now'
|
||||||
} catch {
|
} catch {
|
||||||
return 'Invalid Date'
|
return 'Invalid Date'
|
||||||
@@ -40,6 +48,7 @@
|
|||||||
|
|
||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import { locale } from '$lib/i18n/translations'
|
import { locale } from '$lib/i18n/translations'
|
||||||
|
import { settings } from '$lib/settings.svelte'
|
||||||
|
|
||||||
const toLocaleDateString = (date: Date): string => {
|
const toLocaleDateString = (date: Date): string => {
|
||||||
try {
|
try {
|
||||||
|
|||||||
@@ -814,6 +814,10 @@
|
|||||||
"reverseActions": {
|
"reverseActions": {
|
||||||
"title": "Reverse action row",
|
"title": "Reverse action row",
|
||||||
"description": "Reverses the order of actions on posts and comments."
|
"description": "Reverses the order of actions on posts and comments."
|
||||||
|
},
|
||||||
|
"absoluteDates": {
|
||||||
|
"title": "Absolute timestamps",
|
||||||
|
"description": "Replaces relative timestamps (3 hours ago) with absolute ones (15/6/25)"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"embeds": {
|
"embeds": {
|
||||||
|
|||||||
@@ -97,10 +97,12 @@ interface Settings {
|
|||||||
useRtl: boolean
|
useRtl: boolean
|
||||||
parseTags: boolean
|
parseTags: boolean
|
||||||
logoColorMonth: number | null
|
logoColorMonth: number | null
|
||||||
|
|
||||||
|
absoluteDates: boolean
|
||||||
}
|
}
|
||||||
|
|
||||||
export const defaultSettings: Settings = {
|
export const defaultSettings: Settings = {
|
||||||
settingsVer: 3,
|
settingsVer: 4,
|
||||||
expandableImages: toBool(env.PUBLIC_EXPANDABLE_IMAGES) ?? true,
|
expandableImages: toBool(env.PUBLIC_EXPANDABLE_IMAGES) ?? true,
|
||||||
markReadPosts: toBool(env.PUBLIC_MARK_READ_POSTS) ?? true,
|
markReadPosts: toBool(env.PUBLIC_MARK_READ_POSTS) ?? true,
|
||||||
showInstances: {
|
showInstances: {
|
||||||
@@ -171,6 +173,7 @@ export const defaultSettings: Settings = {
|
|||||||
useRtl: false,
|
useRtl: false,
|
||||||
parseTags: true,
|
parseTags: true,
|
||||||
logoColorMonth: null,
|
logoColorMonth: null,
|
||||||
|
absoluteDates: false,
|
||||||
}
|
}
|
||||||
|
|
||||||
function createSettingsState(initial: Settings): Settings {
|
function createSettingsState(initial: Settings): Settings {
|
||||||
|
|||||||
@@ -381,6 +381,11 @@
|
|||||||
title={$t('settings.app.limitLayoutWidth.title')}
|
title={$t('settings.app.limitLayoutWidth.title')}
|
||||||
description={$t('settings.app.limitLayoutWidth.description')}
|
description={$t('settings.app.limitLayoutWidth.description')}
|
||||||
/>
|
/>
|
||||||
|
<ToggleSetting
|
||||||
|
bind:checked={settings.absoluteDates}
|
||||||
|
title={$t('settings.app.absoluteDates.title')}
|
||||||
|
description={$t('settings.app.absoluteDates.description')}
|
||||||
|
/>
|
||||||
<ToggleSetting
|
<ToggleSetting
|
||||||
supportedPlatforms={{ desktop: false, tablet: false, mobile: true }}
|
supportedPlatforms={{ desktop: false, tablet: false, mobile: true }}
|
||||||
bind:checked={settings.dock.autoHide}
|
bind:checked={settings.dock.autoHide}
|
||||||
|
|||||||
Reference in new issue
Block a user