This is a migrated thread and some comments may be shown as answers.

RadScheduler: Abcent seconds in start/end data

4 Answers 29 Views
Scheduler
This is a migrated thread and some comments may be shown as answers.
Anatoliy
Top achievements
Rank 2
Anatoliy asked on 23 Mar 2020, 04:20 PM
 [Appointment Object] args.get_appointment().get_start() & args.get_appointment().get_end() functions gives "00" seconds at that time on create appointment user put the custom seconds and edit view shows that. Could you help with this occasion?

4 Answers, 1 is accepted

Sort by
0
Peter Milchev
Telerik team
answered on 26 Mar 2020, 12:25 PM

Hello Анатолій,

This behavior seems to be observed only when using the XmlSchedulerProvider, due to the date format used to keep the dates in Xml file: 

                /// <summary>
		/// Format string for the dates. The "Z" appendix signifies UTC time.
		/// </summary>
		private const string DateFormatString = "yyyy-MM-ddTHH:mmZ";

If the seconds are crucial in your application, you can create your custom XmlProvider using the built-in one as a reference point. The source code can be downloaded from Your Account:

Regards,
Peter Milchev
Progress Telerik

Progress is here for your business, like always. Read more about the measures we are taking to ensure business continuity and help fight the COVID-19 pandemic.
Our thoughts here at Progress are with those affected by the outbreak.
0
Anatoliy
Top achievements
Rank 2
answered on 27 Mar 2020, 08:49 AM

We are using in production version 2015.2.623.45. So it's critical for our customers.

There no problems with time format as I mentioned that on 'Edit' we have right seconds in the editing field. Problem have place only at scheduling tool-tips.

Are there any easy solutions to complete this case?

0
Anatoliy
Top achievements
Rank 2
answered on 27 Mar 2020, 08:58 AM
We are using asp:ObjectDataSource  as data provider for RadScheduler control
0
Accepted
Peter Milchev
Telerik team
answered on 30 Mar 2020, 01:39 PM

Hello Anatoliy,

You are correct, the client-side objects of the appointments have the dates in the following format: "yyyy/MM/dd HH:ss". 

To workaround that, you can save the seconds in OnAppointmentDataBound event to the appointment's attributes.

protected void RadScheduler1_AppointmentDataBound(object sender, SchedulerEventArgs e)
{
    e.Appointment.Attributes.Add("startSeconds", e.Appointment.Start.Second.ToString());
    e.Appointment.Attributes.Add("endSeconds", e.Appointment.End.Second.ToString());
}

Then you can fix the start time as below:

<script>
    function fixSeconds() {
        scheduler = $find("<%= RadScheduler1.ClientID %>");

        scheduler.get_appointments().forEach(function (apt) {
            if (apt.get_attributes().getAttribute("startSeconds")) {
                apt.get_start().setSeconds(apt.get_attributes().getAttribute("startSeconds"));
            }
            if (apt.get_attributes().getAttribute("endSeconds")) {
                apt.get_end().setSeconds(apt.get_attributes().getAttribute("endSeconds"));
            }
        })
        // Sys.Application.remove_load(fixSeconds);  
    }
    Sys.Application.add_load(fixSeconds);
</script>

After applying this fix, the apt.get_start() will return the fixed time, with the correct seconds applied.

Regards,
Peter Milchev
Progress Telerik

Progress is here for your business, like always. Read more about the measures we are taking to ensure business continuity and help fight the COVID-19 pandemic.
Our thoughts here at Progress are with those affected by the outbreak.
Tags
Scheduler
Asked by
Anatoliy
Top achievements
Rank 2
Answers by
Peter Milchev
Telerik team
Anatoliy
Top achievements
Rank 2
Share this question
or