简体   繁体   English

将格式时间 AM / PM 更改为 24 小时时间轴日 fullcalendar

[英]Change Format Time AM / PM to 24 hour Timeline Day fullcalendar

I have a project user jQuery fullcalendar-scheduler, I want to format time to use 24 hour.我有一个项目用户 jQuery fullcalendar-scheduler,我想将时间格式化为 24 小时。 I have config as below, but it didn't work.我有如下配置,但没有用。 Is there something wrong with my code ??我的代码有问题吗??

{
        now: moment().format('YYYY-MM-DD'),
        contentHeight: setUpHeight(),
        aspectRatio: 1.8,
        header: {
            left: 'today prev,next',
            center: 'title',
            right: 'timelineDay,timelineMonth'
        },
        timeFormat: 'H(:mm)',
        defaultView: 'timelineDay',
        resourceLabelText: 'Devices',
        resources: resources,
        events: schedules,
        eventRender: function (event, el) {
            el.qtip({
                content: {
                    delay: 1e3,
                    text: function () {
                        return $('#qtip-content-custom').html(event.description);
                    },
                },
                style: { classes: 'qtip__clases' },
                position: {
                    target: 'mouse',
                    adjust: { x: 7, y: 5 }
                },
            });
        }
}

And the result still use AM / PM, like this :结果仍然使用 AM / PM,如下所示:

enter image description here在此处输入图片说明

SOLUTION: Just add views option like this :解决方案:只需添加这样的views选项:

views: {
  timelineDay: {
    slotLabelFormat: ['H:mm'],
  },
  timelineMonth: {
    slotLabelFormat: ['DD'],
  },
},

Try slotLabelFormat .试试slotLabelFormat

eg例如

slotLabelFormat: ['H:mm']

Change this :改变这一点:

timeFormat: 'H(:mm)',

by :作者:

slotLabelFormat:"HH:mm",

version for 3.9.0 in fullcalender.js inside to globalDefaults : fullcalender.js 中的 3.9.0 版本到 globalDefaults :

maxTime: "24:00:00",
slotLabelFormat: ['H:mm'],

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM