So I need to transition from having a couple of "normal" DatePicker properties (startDate and endDate) to the full calendar property.
I wrote a script to copy the values over (by building the JSON and saving it using ContentService), but it doesn't seem to work reliably for all dates...
What's the "correct" way to store a CalendarEvent type property from code?
Hi,
I think you can do this by using the CalendarEvent class in the KS.Umbraco7.Calendar.Core namespace and convert it to JSON using Newtonsoft.
Maybe something like this:
var data = new KS.Umbraco7.Calendar.Core.CalendarEvent();
data.recurrence = 0;
data.startDate = DateTime.Now;
data.endDate = DateTime.Now.AddHours(2);
var json = Newtonsoft.Json.JsonCovert.SerializeObject(data);
The CalendarEvent look like this:
public class CalendarEvent
{
public int recurrence { get; set; } // 1 - not recurring, 2 - repeat daily, 3 - repeat weekly, 4 - repeat monthly, 5 - repeat yearly
public int weekInterval { get; set; } //If repeat weekly this tells you if its every week, every 2nd week, every 3rd week etc.
public int monthYearOption { get; set; } //1 - Use startdate, 2 - Specify weekday etc. for event
public int? monthOption { get; set; } // 1 - Evert month, 2 - Choose months
public int interval { get; set; } //interval of weekly events
public int weekDay { get; set; } //weekDay for specified monthly and yearly events
public int month { get; set; } //month for specified monthly and yearly events
public int?[] days { get; set; } //array of days 0-6 for daily events
public int?[] months { get; set; }//array of monts 1-12 for monthly events
public List
How to correctly store a CalendarEvent value?
Hi again,
So I need to transition from having a couple of "normal" DatePicker properties (
startDate
andendDate
) to the full calendar property.I wrote a script to copy the values over (by building the JSON and saving it using ContentService), but it doesn't seem to work reliably for all dates...
What's the "correct" way to store a CalendarEvent type property from code?
/Chriztian
Hi, I think you can do this by using the CalendarEvent class in the KS.Umbraco7.Calendar.Core namespace and convert it to JSON using Newtonsoft.
Maybe something like this:
The CalendarEvent look like this:
Don't add any value to the content property.
Thanks Ole,
I'll try that, though it's basically what I do now — I'm just not using the event. But I will try it and see if it works :-)
/Chriztian
is working on a reply...
This forum is in read-only mode while we transition to the new forum.
You can continue this topic on the new forum by tapping the "Continue discussion" link below.