Programmatically set date

4 posts, 1 answers
  1. Randy
    Randy avatar
    3 posts
    Member since:
    May 2009

    Posted 14 Mar 2014 Link to this post

    I have attempted to set the "date" in scheduler using the following:

    var startDate = Date.parse(start);
    var scheduler = $("#scheduler").data("kendoScheduler");
    scheduler.setOptions({ date: startDate });
    scheduler.view(scheduler.view().name);

    When the scheduler widget displays, the current week, or day is shown. I currently do not have the date: or startTime: fields in my scheduler definition.

    $("#scheduler").kendoScheduler({
        // Cannot edit tasks in schedule
        editable: false,
        // Define allowable scheduler views
        views: [
            { type: "day",
                dateHeaderTemplate: kendo.template($("#header-template").html())
            },
            { type: "week",
                dateHeaderTemplate: kendo.template($("#header-template").html()),
                selected: true
            },
            "month"
        ],
        footer: false,
        // Define how the hours are displayed
        majorTimeHeaderTemplate: kendo.template("<strong>#=kendo.toString(date,'HH')#</strong><sup>00</sup>"),
        eventTemplate: $("#event-template").html(),
        // 2 ticks between hours
        minorTickCount: 2,
        resources: [
            {
                field: "segment",
                dataSource: []
            }
        ],
        navigate: scheduler_navigate
    });
  2. Answer
    Georgi Krustev
    Admin
    Georgi Krustev avatar
    3707 posts

    Posted 14 Mar 2014 Link to this post

    Hello Randy,

    I would suggest you try the scheduler's date method, which sets the current date:
    Regards,
    Georgi Krustev
    Telerik
     
    Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
     
  3. Kendo UI is VS 2017 Ready
  4. Aaron
    Aaron avatar
    20 posts
    Member since:
    Jan 2015

    Posted 08 Dec 2015 in reply to Georgi Krustev Link to this post

    Georgi,

     That link is useless.  Is there an actual way to set the date to today?  All the examples in your demos use the same date and that is not very useful when it is no longer 2013 :D

  5. Georgi Krustev
    Admin
    Georgi Krustev avatar
    3707 posts

    Posted 09 Dec 2015 Link to this post

    Hello Aaron,

    Please excuse me for the incorrect link. I updated it in my initial message. Nevertheless, here is the link to the date method:
    Regards,
    Georgi Krustev
    Telerik
     
    Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
     
Back to Top
Kendo UI is VS 2017 Ready