Skip to content

Commit 380fe48

Browse files
committed
web: Fix date render error
1 parent 5587214 commit 380fe48

File tree

3 files changed

+11
-6
lines changed

3 files changed

+11
-6
lines changed

web/components/club/club-activity-table.vue

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,8 @@ export default defineComponent({
6868
required: false
6969
},
7070
},
71-
async setup(props) {
71+
setup(props) {
72+
console.log(props.clubActivityStatistics)
7273
const rows = computed(() => props.club.members.map(m => ({
7374
tag: m.tag,
7475
name: m.name,

web/composables/date-fns.ts

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { computed, ref, MaybeRef, unref, watch } from 'vue'
1+
import { computed, MaybeRef, unref, watch, useId } from 'vue'
22
import { useI18n } from 'vue-i18n'
33
import { LocaleIso } from '~/locales'
44
import { Locale, format, formatDistanceToNow } from 'date-fns'
@@ -46,8 +46,9 @@ export const useDateFnLocale = () => {
4646
/** SSR-friendly relative date formatting */
4747
export const useFormattedDistanceToNow = (timestamp: MaybeRef<Date|undefined>, { addSuffix }: { addSuffix: MaybeRef<boolean> }) => {
4848
const { locale } = useDateFnLocale()
49+
const id = useId()
4950

50-
const formatted = ssrRef('…', computed(() => `timediff-${unref(timestamp)}`))
51+
const formatted = ssrRef('…', `timediff-${id}`)
5152

5253
const updateFormatted = () => {
5354
const ts = unref(timestamp)
@@ -60,7 +61,7 @@ export const useFormattedDistanceToNow = (timestamp: MaybeRef<Date|undefined>, {
6061
})
6162
}
6263
}
63-
watch(() => [timestamp, locale], updateFormatted, {
64+
watch(() => [unref(timestamp), unref(locale)], updateFormatted, {
6465
immediate: true,
6566
})
6667

@@ -71,15 +72,16 @@ export const useFormattedDistanceToNow = (timestamp: MaybeRef<Date|undefined>, {
7172
/** SSR-friendly date formatting */
7273
export const useFormattedDate = (timestamp: MaybeRef<Date>, formatStr: MaybeRef<string>) => {
7374
const { locale } = useDateFnLocale()
75+
const id = useId()
7476

75-
const formatted = ssrRef('…', computed(() => `timestamp-${unref(timestamp)}-${unref(formatStr)}`))
77+
const formatted = ssrRef('…', `timestamp-${id}`)
7678

7779
const updateFormatted = () => {
7880
formatted.value = format(unref(timestamp), unref(formatStr), {
7981
locale: locale.value,
8082
})
8183
}
82-
watch(() => [timestamp, formatStr, locale], updateFormatted, {
84+
watch(() => [unref(timestamp), unref(formatStr), unref(locale)], updateFormatted, {
8385
immediate: true,
8486
})
8587

web/locales/en.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -252,6 +252,8 @@
252252
"mode.brawlBall": "Brawl Ball",
253253
"mode.duoShowdown": "Duo Showdown",
254254
"mode.gemGrab": "Gem Grab",
255+
"mode.gemGrab5V5": "Gem Grab 5V5",
256+
"mode.lastStand": "Last Stand",
255257
"mode.heist": "Heist",
256258
"mode.holdTheTrophy": "Hold The Trophy",
257259
"mode.hotZone": "Hot Zone",

0 commit comments

Comments
 (0)