UI5 OverlapCalendar问题

时间:2016-02-15 12:35:23

标签: datetime calendar sapui5

使用OverlapCalendar我遇到了一些奇怪的问题。我认为这是由于夏令时,因为我的输入是3月28日,但它在3月27日(应该是周末)变成彩色,然后4月1日显示为非工作日。其他人是否遇到过同样的问题和行为?

请在下面找到我的代码。

    sap.ui.jsview("calendartest.CalendarView", {

    /** Specifies the Controller belonging to this View. 
    * In the case that it is not implemented, or that "null" is returned, this View does not have a Controller.
    * @memberOf calendartest.CalendarView
    */ 
    getControllerName : function() {
        return "calendartest.CalendarView";
    },

    /** Is initially called once after the Controller has been instantiated. It is the place where the UI is constructed. 
    * Since the Controller is given to this method, its event handlers can be attached right away. 
    * @memberOf calendartest.CalendarView
    */ 
    createContent : function(oController) {

        var oModel = new sap.ui.model.json.JSONModel();

        var jsonCalendarData = { "list" :
            [{
                "startDate" : "2016-03-21T00:00:00",
                "endDate" : "2016-03-21T00:00:00",
                "type" : "06",
                "name" : "Peter Norman"
            }, {
                "startDate" : "2016-03-22T00:00:00",
                "endDate" : "2016-03-22T00:00:00",
                "type" : "06",
                "name" : "Peter Norman"
            }, {
                "startDate" : "2016-03-23T00:00:00",
                "endDate" : "2016-03-23T00:00:00",
                "type" : "06",
                "name" : "Peter Norman"
            }, {
                "startDate" : "2016-03-24T00:00:00",
                "endDate" : "2016-03-24T00:00:00",
                "type" : "06",
                "name" : "Peter Norman"
            }, {
                "startDate" : "2016-03-25T00:00:00",
                "endDate" : "2016-03-25T00:00:00",
                "type" : "06",
                "name" : "Peter Norman"
            },  {
                "startDate" : "2016-03-28T00:00:00",
                "endDate" : "2016-03-28T00:00:00",
                "type" : "06",
                "name" : "Peter Norman"
            },  {
                "startDate" : "2016-03-29T00:00:00",
                "endDate" : "2016-03-29T00:00:00",
                "type" : "06",
                "name" : "Peter Norman"
            },  {
                "startDate" : "2016-03-30T00:00:00",
                "endDate" : "2016-03-30T00:00:00",
                "type" : "06",
                "name" : "Peter Norman"
            },  {
                "startDate" : "2016-03-31T00:00:00",
                "endDate" : "2016-03-31T00:00:00",
                "type" : "06",
                "name" : "Peter Norman"
            },  {
                "startDate" : "2016-04-01T00:00:00",
                "endDate" : "2016-04-01T00:00:00",
                "type" : "06",
                "name" : "Peter Norman"
            },  {
                "startDate" : "2016-04-04T00:00:00",
                "endDate" : "2016-04-04T00:00:00",
                "type" : "06",
                "name" : "Peter Norman"
            },  {
                "startDate" : "2016-04-05T00:00:00",
                "endDate" : "2016-04-05T00:00:00",
                "type" : "06",
                "name" : "Peter Norman"
            },  {
                "startDate" : "2016-04-06T00:00:00",
                "endDate" : "2016-04-06T00:00:00",
                "type" : "06",
                "name" : "Peter Norman"
            },  {
                "startDate" : "2016-04-07T00:00:00",
                "endDate" : "2016-04-07T00:00:00",
                "type" : "06",
                "name" : "Peter Norman"
            },  {
                "startDate" : "2016-04-08T00:00:00",
                "endDate" : "2016-04-08T00:00:00",
                "type" : "06",
                "name" : "Peter Norman"
            },  {
                "startDate" : "2016-04-11T00:00:00",
                "endDate" : "2016-04-11T00:00:00",
                "type" : "06",
                "name" : "Peter Norman"
            },  {
                "startDate" : "2016-04-12T00:00:00",
                "endDate" : "2016-04-12T00:00:00",
                "type" : "06",
                "name" : "Peter Norman"
            },  {
                "startDate" : "2016-04-13T00:00:00",
                "endDate" : "2016-04-13T00:00:00",
                "type" : "06",
                "name" : "Peter Norman"
            },  {
                "startDate" : "2016-04-14T00:00:00",
                "endDate" : "2016-04-14T00:00:00",
                "type" : "06",
                "name" : "Peter Norman"
            },  {
                "startDate" : "2016-04-15T00:00:00",
                "endDate" : "2016-04-15T00:00:00",
                "type" : "06",
                "name" : "Peter Norman"
            }
        ]};

        oModel.setData(jsonCalendarData.list);

        var oCalendar = new sap.me.OverlapCalendar({
              id: "oCalendar30Days",
              showOverlapIndicator:false,
              weeksPerRow: 2,
              startDate :  new Date()
        });


        var eventTemplate = new sap.me.OverlapCalendarEvent({
            startDay : {
                parts : ['startDate'],
                formatter : function(beginDate) {
                    return beginDate;
                }
            },
            endDay : {
                parts : ['endDate'],
                formatter : function(endDate) {
                    return endDate;
                }
            },
            row : 1,
            type : {
                parts : ['type'],
                formatter : function(flag) {
                        return flag;
                    }
                },
            halfDay : false
        });



        eventTemplate.bindProperty("name","name", function(bValue){
            return bValue;
        });


        oCalendar.setModel(oModel);
        oCalendar.bindAggregation("calendarEvents","/", eventTemplate);


        return new sap.m.Page({
            title: "Calendar Test",
            content: [
                      oCalendar
            ]
        });
    }

});

来自结果的图像: Image

0 个答案:

没有答案