Skip to content

Commit

Permalink
refactor: Adjust news time format
Browse files Browse the repository at this point in the history
  • Loading branch information
ci010 committed Dec 27, 2023
1 parent 3faa99a commit 4363ca0
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 5 deletions.
3 changes: 0 additions & 3 deletions xmcl-keystone-ui/src/util/date.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,6 @@ export function getLocalDateString(s: string | number, options?: TimeFormatOptio
return d.toLocaleString()
}
}
export function getLocalTimeString(s: string | number) {
return new Date(s).toLocaleString()
}

export enum TimeUnit {
Second = 1000,
Expand Down
5 changes: 3 additions & 2 deletions xmcl-keystone-ui/src/views/HomeNewsCard.vue
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
{{ news.title }}
</v-card-title>
<v-card-subtitle>
{{ new Date(news.date).toLocaleDateString() }}
{{ getDateString(news.date, { dateStyle: 'long' }) }}
</v-card-subtitle>
<v-card-text
class="flex-grow"
Expand All @@ -40,14 +40,15 @@
</v-hover>
</template>
<script lang="ts" setup>
import { useDateString } from '@/composables/date'
import { NewsItem } from '@/composables/mojangNews'
const props = defineProps<{
news: NewsItem
}>()
const { t } = useI18n()
const { getDateString } = useDateString()
const nav = () => {
window.location.href = props.news.readMoreLink
}
Expand Down

0 comments on commit 4363ca0

Please sign in to comment.