Hi, having difficulty understanding my problem and why it appears.
Basically, I'm adding an entry to my google calendar being in the UK the BST (British Summer Time) begins on the 27th of March until 30th October 2022, if I create a diary entry before the 27th of March the entry is added correctly, as is an entry added after 30th October but I add one between these dates it adds the entry to the day before, i.e. if I add one for today (16th April) the entry adds to the 15th April.
The save module is below, and I'm struggling to understand why this is happening, any help greatly received
Basically, I'm adding an entry to my google calendar being in the UK the BST (British Summer Time) begins on the 27th of March until 30th October 2022, if I create a diary entry before the 27th of March the entry is added correctly, as is an entry added after 30th October but I add one between these dates it adds the entry to the day before, i.e. if I add one for today (16th April) the entry adds to the 15th April.
The save module is below, and I'm struggling to understand why this is happening, any help greatly received
B4X:
Sub btnSave_Click
Dim chkDay As Int
DateTime.DateFormat = "dd/MM/yyyy"
DateTime.TimeFormat = "HH:mm"
Dim ChkDate As String = DateTime.Date(Main.DateRet)
If chkAllDay.Checked = True Then
Dim tfrom As Long = Main.DateRet
Dim tTo As Long = Main.DateRet
chkDay=1
Else
If btnTimeFrom.xLBL.Text = "" Then 'needs better error checking
Msgbox("No time entered or All day not checked", "Time(s) or All day required")
Return
End If
Dim tfrom As Long = DateTime.datetimeParse(ChkDate,btnTimeFrom.xLBL.Text)
Dim tTo As Long = DateTime.datetimeParse(ChkDate,btnTimeTo.xLBL.Text)
chkDay=0
End If
Log("chkDate " & ChkDate & " tTo " & tTo & " tfrom " & tfrom)
Dim econValues As List
econValues.Initialize
econValues.Add(Main.wmCalendar1.econ.ALL_DAY)
econValues.Add(Main.wmCalendar1.econ.DESCRIPTION)
econValues.Add(Main.wmCalendar1.econ.DTEND)
econValues.Add(Main.wmCalendar1.econ.DTSTART)
econValues.Add(Main.wmCalendar1.econ.TITLE)
econValues.Add(Main.wmCalendar1.econ.ORGANIZER)
econValues.Add(Main.wmCalendar1.econ.LOCATION)
econValues.Add(Main.wmCalendar1.econ.EVENT_END_TIMEZONE)
econValues.Add(Main.wmCalendar1.econ.EVENT_TIMEZONE)
Dim theEvent As EventInfo
theEvent.Initialize
theEvent.allDay = chkDay
theEvent.description = txtDescription.Text
theEvent.visible = 1
theEvent.dateTimeEnd = tTo
theEvent.dateTimeStart = tfrom
theEvent.title = txtTitle.Text
theEvent.organizer = txtOrganiser.Text
theEvent.location = txtLocation.Text
theEvent.timeZone = "UTC"
theEvent.endTimeZone = "UTC"
Log("the event " & theEvent)
Dim newEventID As Int = Main.wmCalendar1.AddEvent(Main.ScalendarID, theEvent, econValues)
If newEventID < 0 Then
Msgbox("The Entry could not be added", "DITL Calendar")
Else
Msgbox("The Entry has been added", "DITL Calendar")
End If
StartActivity(Main)
End Sub