0

I am using the fullcalendar,

but in IE 10 or 11 the events are not render correct,

I have this:

public static List<DiaryEvent> LoadAllAppointmentsInDateRange(double start, double end)
        {
            var fromDate = ConvertFromUnixTimestamp(start);
            var toDate = ConvertFromUnixTimestamp(end);
            using (LolaBikeContext ent = new LolaBikeContext())
            {
                var rslt = ent.AppointmentDiarys.Where(s => s.DateTimeScheduled >= fromDate && System.Data.Entity.DbFunctions.AddMinutes(s.DateTimeScheduled, s.AppointmentLength) <= toDate);

                List<DiaryEvent> result = new List<DiaryEvent>();
                foreach (var item in rslt)
                {
                    DiaryEvent rec = new DiaryEvent();
                    rec.ID = item.Id;
                    rec.SomeImportantKeyID = item.SomeImportantKey;
                    rec.StartDateString = item.DateTimeScheduled.ToString("MMMM/dd/yyyy"); // "s" is a preset format that outputs as: "2009-02-27T12:12:22"
                    rec.StarEvent = item.DateTimeScheduled.ToString("HH:mm"); // ParseExact(start, "HH:mm", CultureInfo.CurrentCulture).ToString();      //item.DateTimeScheduled.ToString("MMMM/dd/yyyy");
                    rec.EndDateString = item.DateTimeScheduled.AddMinutes(item.AppointmentLength).ToString("yyyy-MM-ddTHH\\:mm\\:ss.fffffffzzz");//  "yyyy-MM-ddTHH:mm:ss.fffZ"); // field AppointmentLength is in minutes
                    rec.Title = item.Title;// +" - " + item.AppointmentLength.ToString() + " mins";

                    rec.AppointmentLength = item.AppointmentLength.ToString();

                    rec.StatusString = Enums.GetName<AppointmentStatus>((AppointmentStatus)item.StatusENUM);
                    rec.StatusColor = Enums.GetEnumDescription<AppointmentStatus>(rec.StatusString);
                    string ColorCode = rec.StatusColor.Substring(0, rec.StatusColor.IndexOf(":"));
                    rec.ClassName = rec.StatusColor.Substring(rec.StatusColor.IndexOf(":") + 1, rec.StatusColor.Length - ColorCode.Length - 1);
                    rec.StatusColor = ColorCode;
                    result.Add(rec);
                }

                return result;
            }

        }

and especially this line:

  rec.EndDateString = item.DateTimeScheduled.AddMinutes(item.AppointmentLength).ToString("yyyy-MM-ddTHH\\:mm\\:ss.fffffffzzz");// is not rendering correct.

I have read that it has to be in: ISO 8601, so I have looked at this thread:

Given a DateTime object, how do I get an ISO 8601 date in string format?

but that doesnt work. IE is rendering the events not correct

Thank you!!

see the different picturesenter image description here The correct image: enter image description here

Community
  • 1
  • 1
Niels hoi
  • 71
  • 6

1 Answers1

0

I think youare missing the "s" format specifier, which is described as Sortable date/time pattern; conforms to ISO 8601

The EventStart comes in ISO 8601 format and you will need to convert it. you can follow this example to convert current to ISO 8601:

DateTime.UtcNow.ToString ( "s", System.Globalization.CultureInfo.InvariantCulture )

Here's a post about that : Link As for your code try this instead for your startdatestring and enddatestring:

 rec.StartDateString = item.DateTimeScheduled.ToString("s");


rec.EndDateString = item.DateTimeScheduled.AddMinutes(item.AppointmentLength).ToString("s");
Community
  • 1
  • 1
IndieTech Solutions
  • 2,527
  • 1
  • 21
  • 36