小编siv*_*ouz的帖子

如何将 vuetify 日历间隔格式更改为 24 小时?

我正在使用类型为 week 的 vuetify 日历,它以 12 小时格式显示时间,包括 AM 和 PM。我如何将其更改为 24 小时格式?

我查看了文档并没有找到太多内容,除了您可以传递期望函数的间隔格式道具。在 vuetify github 上也找到了一个函数。

    <v-calendar
                :now="today"
                :value="today"
                color="primary"
                locale="et"
                type="week"
                :interval-format="intervalFormat"
            >
            </v-calendar>

methods: {
        intervalFormat() {
            const longOptions = { timeZone: 'UTC', hour12: true, hour: '2-digit', minute: '2-digit' }
            const shortOptions = { timeZone: 'UTC', hour12: true, hour: 'numeric', minute: '2-digit' }
            const shortHourOptions = { timeZone: 'UTC', hour12: true, hour: 'numeric' }

            return longOptions
        }
    }
Run Code Online (Sandbox Code Playgroud)

我想要 24 小时格式,但它仍然是 12 小时格式

javascript calendar vue.js vuetify.js

4
推荐指数
1
解决办法
2932
查看次数

标签 统计

calendar ×1

javascript ×1

vue.js ×1

vuetify.js ×1