Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / lazarus / 2020-06

Google Calendar API TEvent start or _end (TDatetime) question

18 messages · 5 people · –

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Francesco Sammarco

Hi everyone, I have the following problem. I have a calendar (Italian) to sync with Google Calendar. With the following code I can work quite well. If today (2020-06-03) I set a new appointment it is saved on google calendar on the right day and time, but if for example: always today if I set an appointment for December 10, 2020 at 9 am, I find myself there appointment set on the right day but at 8 am. (So an hour behind) I think it's due to the change between sunlight and daylight. Can anyone explain to me how to solve the problem?

Thank you
XinYiMan

var
   start_e  : TEventDateTime;
   end_e    : TEventDateTime;
   Entry    : TEvent;
begin
            Entry := FCalendarAPI.EventsResource.Get(CalendarFindedId,
my_id_app);
                     start_e := TEventDateTime.Create();
                     end_e   := TEventDateTime.Create();
                     start_e.dateTime   := data_appuntamento;
                     start_e.dateTime   :=
LocalTimeToUniversal(start_e.dateTime);
                     start_e.timeZone   := 'Europe/Rome';
                     end_e.dateTime     :=
IncMinute(LocalTimeToUniversal(data_appuntamento),15);
                     end_e.timeZone     := 'Europe/Rome';
                     Entry.start                 := start_e;
                     Entry._end                  := end_e;

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lazarus-ide.org/pipermail/lazarus/attachments/20200603/0b5af3b5/attachment.html>

Reply by email

Michael Van Canneyt
to Francesco Sammarco
Francesco Sammarco wrote 29 lines
Hi everyone, I have the following problem. I have a calendar (Italian) to sync with Google Calendar. With the following code I can work quite well. If today (2020-06-03) I set a new appointment it is saved on google calendar on the right day and time, but if for example: always today if I set an appointment for December 10, 2020 at 9 am, I find myself there appointment set on the right day but at 8 am. (So an hour behind) I think it's due to the change between sunlight and daylight. Can anyone explain to me how to solve the problem? Thank you XinYiMan var start_e : TEventDateTime; end_e : TEventDateTime; Entry : TEvent; begin Entry := FCalendarAPI.EventsResource.Get(CalendarFindedId, my_id_app); start_e := TEventDateTime.Create(); end_e := TEventDateTime.Create(); start_e.dateTime := data_appuntamento; start_e.dateTime := LocalTimeToUniversal(start_e.dateTime); start_e.timeZone := 'Europe/Rome';

If you set the timzeone explicitly, I don't think you must do a LocalTimeToUniversal, I think the timezone is then automatically taken into account. As I understand it you specify the timezone in dateTime or you set it in the timezone.

Michael.

Reply by email

Francesco Sammarco
to Michael Van Canneyt

sorry I don't understand, you say that just remove the lines where I specify the timezone ?!

Il mer 3 giu 2020, 14:51 Michael Van Canneyt ha
scritto:

Show quoted text 43 lines
On Wed, 3 Jun 2020, Francesco Sammarco via lazarus wrote: > Hi everyone, I have the following problem. I have a calendar (Italian) to > sync with Google Calendar. With the following code I can work quite well. > If today (2020-06-03) I set a new appointment it is saved on google > calendar on the right day and time, but if for example: always today if I > set an appointment for December 10, 2020 at 9 am, I find myself there > appointment set on the right day but at 8 am. (So an hour behind) I think > it's due to the change between sunlight and daylight. Can anyone explain to > me how to solve the problem? > > Thank you > XinYiMan > > > > var > start_e : TEventDateTime; > end_e : TEventDateTime; > Entry : TEvent; > begin > Entry := FCalendarAPI.EventsResource.Get(CalendarFindedId, > my_id_app); > > start_e := TEventDateTime.Create(); > end_e := TEventDateTime.Create(); > > start_e.dateTime := data_appuntamento; > start_e.dateTime := > LocalTimeToUniversal(start_e.dateTime); > start_e.timeZone := 'Europe/Rome'; If you set the timzeone explicitly, I don't think you must do a LocalTimeToUniversal, I think the timezone is then automatically taken into account. As I understand it you specify the timezone in dateTime or you set it in the timezone. Michael.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lazarus-ide.org/pipermail/lazarus/attachments/20200603/8ea35a7f/attachment.html>

Reply by email

Michael Van Canneyt
to Francesco Sammarco
Francesco Sammarco wrote
sorry I don't understand, you say that just remove the lines where I specify the timezone ?!

No, remove the

start_e.dateTime   := LocalTimeToUniversal(start_e.dateTime);

I think it is not necessary if you set the timezone.

Michael.

Show quoted text 48 lines
Il mer 3 giu 2020, 14:51 Michael Van Canneyt ha scritto: > > > On Wed, 3 Jun 2020, Francesco Sammarco via lazarus wrote: > >> Hi everyone, I have the following problem. I have a calendar (Italian) to >> sync with Google Calendar. With the following code I can work quite well. >> If today (2020-06-03) I set a new appointment it is saved on google >> calendar on the right day and time, but if for example: always today if I >> set an appointment for December 10, 2020 at 9 am, I find myself there >> appointment set on the right day but at 8 am. (So an hour behind) I think >> it's due to the change between sunlight and daylight. Can anyone explain > to >> me how to solve the problem? >> >> Thank you >> XinYiMan >> >> >> >> var >> start_e : TEventDateTime; >> end_e : TEventDateTime; >> Entry : TEvent; >> begin >> Entry := FCalendarAPI.EventsResource.Get(CalendarFindedId, >> my_id_app); >> >> start_e := TEventDateTime.Create(); >> end_e := TEventDateTime.Create(); >> >> start_e.dateTime := data_appuntamento; >> start_e.dateTime := >> LocalTimeToUniversal(start_e.dateTime); >> start_e.timeZone := 'Europe/Rome'; > > If you set the timzeone explicitly, I don't think you must do a > LocalTimeToUniversal, > I think the timezone is then automatically taken into account. As I > understand it you specify the timezone in dateTime or you set it in the > timezone. > > Michael. >

Reply by email

Francesco Sammarco
to Michael Van Canneyt

sorry and how do I set the date and time of the apartment ?!

Il mer 3 giu 2020, 15:55 Michael Van Canneyt ha
scritto:

Show quoted text 70 lines
On Wed, 3 Jun 2020, Francesco Sammarco wrote: > sorry I don't understand, you say that just remove the lines where I > specify the timezone ?! No, remove the start_e.dateTime := LocalTimeToUniversal(start_e.dateTime); I think it is not necessary if you set the timezone. Michael. > > Il mer 3 giu 2020, 14:51 Michael Van Canneyt ha > scritto: > >> >> >> On Wed, 3 Jun 2020, Francesco Sammarco via lazarus wrote: >> >>> Hi everyone, I have the following problem. I have a calendar (Italian) to >>> sync with Google Calendar. With the following code I can work quite well. >>> If today (2020-06-03) I set a new appointment it is saved on google >>> calendar on the right day and time, but if for example: always today if I >>> set an appointment for December 10, 2020 at 9 am, I find myself there >>> appointment set on the right day but at 8 am. (So an hour behind) I think >>> it's due to the change between sunlight and daylight. Can anyone explain >> to >>> me how to solve the problem? >>> >>> Thank you >>> XinYiMan >>> >>> >>> >>> var >>> start_e : TEventDateTime; >>> end_e : TEventDateTime; >>> Entry : TEvent; >>> begin >>> Entry := FCalendarAPI.EventsResource.Get(CalendarFindedId, >>> my_id_app); >>> >>> start_e := TEventDateTime.Create(); >>> end_e := TEventDateTime.Create(); >>> >>> start_e.dateTime := data_appuntamento; >>> start_e.dateTime := >>> LocalTimeToUniversal(start_e.dateTime); >>> start_e.timeZone := 'Europe/Rome'; >> >> If you set the timzeone explicitly, I don't think you must do a >> LocalTimeToUniversal, >> I think the timezone is then automatically taken into account. As I >> understand it you specify the timezone in dateTime or you set it in the >> timezone. >> >> Michael. >> >

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lazarus-ide.org/pipermail/lazarus/attachments/20200603/a1495a25/attachment.html>

Reply by email

Michael Van Canneyt
to Francesco Sammarco
Francesco Sammarco wrote
sorry and how do I set the date and time of the apartment ?!

I would think this is sufficient:

   Entry := FCalendarAPI.EventsResource.Get(CalendarFindedId, my_id_app);
   start_e := TEventDateTime.Create();
   end_e   := TEventDateTime.Create();
   start_e.dateTime   := data_appuntamento;
   start_e.timeZone   := 'Europe/Rome';

Michael.

Show quoted text 75 lines
Il mer 3 giu 2020, 15:55 Michael Van Canneyt ha scritto: > > > On Wed, 3 Jun 2020, Francesco Sammarco wrote: > >> sorry I don't understand, you say that just remove the lines where I >> specify the timezone ?! > > No, remove the > > start_e.dateTime := LocalTimeToUniversal(start_e.dateTime); > > I think it is not necessary if you set the timezone. > > Michael. > > >> >> Il mer 3 giu 2020, 14:51 Michael Van Canneyt ha >> scritto: >> >>> >>> >>> On Wed, 3 Jun 2020, Francesco Sammarco via lazarus wrote: >>> >>>> Hi everyone, I have the following problem. I have a calendar (Italian) > to >>>> sync with Google Calendar. With the following code I can work quite > well. >>>> If today (2020-06-03) I set a new appointment it is saved on google >>>> calendar on the right day and time, but if for example: always today > if I >>>> set an appointment for December 10, 2020 at 9 am, I find myself there >>>> appointment set on the right day but at 8 am. (So an hour behind) I > think >>>> it's due to the change between sunlight and daylight. Can anyone > explain >>> to >>>> me how to solve the problem? >>>> >>>> Thank you >>>> XinYiMan >>>> >>>> >>>> >>>> var >>>> start_e : TEventDateTime; >>>> end_e : TEventDateTime; >>>> Entry : TEvent; >>>> begin >>>> Entry := FCalendarAPI.EventsResource.Get(CalendarFindedId, >>>> my_id_app); >>>> >>>> start_e := TEventDateTime.Create(); >>>> end_e := TEventDateTime.Create(); >>>> >>>> start_e.dateTime := data_appuntamento; >>>> start_e.dateTime := >>>> LocalTimeToUniversal(start_e.dateTime); >>>> start_e.timeZone := 'Europe/Rome'; >>> >>> If you set the timzeone explicitly, I don't think you must do a >>> LocalTimeToUniversal, >>> I think the timezone is then automatically taken into account. As I >>> understand it you specify the timezone in dateTime or you set it in the >>> timezone. >>> >>> Michael. >>> >> >

Reply by email

Francesco Sammarco
to Michael Van Canneyt

if I change my code in this mode, and change Google Calendar configuration, with Greenwich meridian, I see correct result on Google Calendar. But I'm not on Greenwich meridian.

I edited the demo calendar. I added a button and inside I put the following code.

procedure TMainForm.Button1Click(Sender: TObject);
var
  Entry     : TEvent;
  Insert    : TEvent;
  start_e   : TEventDateTime;
  end_e     : TEventDateTime;
begin
  if LBCalendars.ItemIndex<0 then
    Exit;
  start_e := TEventDateTime.Create();
  end_e   := TEventDateTime.Create();
  start_e.dateTime   := EncodeDateTime(2020,6,3,19,0,0,0);
  start_e.timeZone   := 'Europe/London';
  end_e.dateTime     := IncHour(start_e.dateTime,2);
  end_e.timeZone     := 'Europe/London';
  Entry := TEvent.Create();
  Entry.summary               := 'My test';
  Entry.description           := 'My test';
  Entry.location              := 'My location';
  Entry.start                 := start_e;
  Entry._end                  := end_e;
  Entry.guestsCanInviteOthers   := false;
  Entry.guestsCanSeeOtherGuests := false;
  Entry.colorId := '';
  Insert := FCalendarAPI.EventsResource.Insert(FCurrentCalendar.id,Entry);
  SaveRefreshToken;
  Entry.Free;
  Entry:=nil;
  ShowMessage('Insert ' + Insert.id);
  Insert.Free;
  Insert:=nil;
end;

Il giorno mer 3 giu 2020 alle ore 15:59 Michael Van Canneyt <

Show quoted text 97 lines
ha scritto: On Wed, 3 Jun 2020, Francesco Sammarco wrote: > sorry and how do I set the date and time of the apartment ?! I would think this is sufficient: Entry := FCalendarAPI.EventsResource.Get(CalendarFindedId, my_id_app); start_e := TEventDateTime.Create(); end_e := TEventDateTime.Create(); start_e.dateTime := data_appuntamento; start_e.timeZone := 'Europe/Rome'; Michael. > > Il mer 3 giu 2020, 15:55 Michael Van Canneyt ha > scritto: > >> >> >> On Wed, 3 Jun 2020, Francesco Sammarco wrote: >> >>> sorry I don't understand, you say that just remove the lines where I >>> specify the timezone ?! >> >> No, remove the >> >> start_e.dateTime := LocalTimeToUniversal(start_e.dateTime); >> >> I think it is not necessary if you set the timezone. >> >> Michael. >> >> >>> >>> Il mer 3 giu 2020, 14:51 Michael Van Canneyt ha >>> scritto: >>> >>>> >>>> >>>> On Wed, 3 Jun 2020, Francesco Sammarco via lazarus wrote: >>>> >>>>> Hi everyone, I have the following problem. I have a calendar (Italian) >> to >>>>> sync with Google Calendar. With the following code I can work quite >> well. >>>>> If today (2020-06-03) I set a new appointment it is saved on google >>>>> calendar on the right day and time, but if for example: always today >> if I >>>>> set an appointment for December 10, 2020 at 9 am, I find myself there >>>>> appointment set on the right day but at 8 am. (So an hour behind) I >> think >>>>> it's due to the change between sunlight and daylight. Can anyone >> explain >>>> to >>>>> me how to solve the problem? >>>>> >>>>> Thank you >>>>> XinYiMan >>>>> >>>>> >>>>> >>>>> var >>>>> start_e : TEventDateTime; >>>>> end_e : TEventDateTime; >>>>> Entry : TEvent; >>>>> begin >>>>> Entry := FCalendarAPI.EventsResource.Get(CalendarFindedId, >>>>> my_id_app); >>>>> >>>>> start_e := TEventDateTime.Create(); >>>>> end_e := TEventDateTime.Create(); >>>>> >>>>> start_e.dateTime := data_appuntamento; >>>>> start_e.dateTime := >>>>> LocalTimeToUniversal(start_e.dateTime); >>>>> start_e.timeZone := 'Europe/Rome'; >>>> >>>> If you set the timzeone explicitly, I don't think you must do a >>>> LocalTimeToUniversal, >>>> I think the timezone is then automatically taken into account. As I >>>> understand it you specify the timezone in dateTime or you set it in the >>>> timezone. >>>> >>>> Michael. >>>> >>> >> >

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lazarus-ide.org/pipermail/lazarus/attachments/20200604/a718dca7/attachment.html>

Reply by email

Michael Van Canneyt
to Francesco Sammarco

Hello,

I'm afraid I am of no help here. I am not an expert on the google Calendar API...

What you can try to do is set the calendar configuration to your timezone (Italy/Rome, I suppose) and do not provide any timezone information when you create your items.

Michael.

Francesco Sammarco wrote 151 lines
if I change my code in this mode, and change Google Calendar configuration, with Greenwich meridian, I see correct result on Google Calendar. But I'm not on Greenwich meridian. I edited the demo calendar. I added a button and inside I put the following code. procedure TMainForm.Button1Click(Sender: TObject); var Entry : TEvent; Insert : TEvent; start_e : TEventDateTime; end_e : TEventDateTime; begin if LBCalendars.ItemIndex<0 then Exit; start_e := TEventDateTime.Create(); end_e := TEventDateTime.Create(); start_e.dateTime := EncodeDateTime(2020,6,3,19,0,0,0); start_e.timeZone := 'Europe/London'; end_e.dateTime := IncHour(start_e.dateTime,2); end_e.timeZone := 'Europe/London'; Entry := TEvent.Create(); Entry.summary := 'My test'; Entry.description := 'My test'; Entry.location := 'My location'; Entry.start := start_e; Entry._end := end_e; Entry.guestsCanInviteOthers := false; Entry.guestsCanSeeOtherGuests := false; Entry.colorId := ''; Insert := FCalendarAPI.EventsResource.Insert(FCurrentCalendar.id,Entry); SaveRefreshToken; Entry.Free; Entry:=nil; ShowMessage('Insert ' + Insert.id); Insert.Free; Insert:=nil; end; Il giorno mer 3 giu 2020 alle ore 15:59 Michael Van Canneyt < > ha scritto: > > > On Wed, 3 Jun 2020, Francesco Sammarco wrote: > >> sorry and how do I set the date and time of the apartment ?! > > I would think this is sufficient: > > Entry := FCalendarAPI.EventsResource.Get(CalendarFindedId, my_id_app); > start_e := TEventDateTime.Create(); > end_e := TEventDateTime.Create(); > start_e.dateTime := data_appuntamento; > start_e.timeZone := 'Europe/Rome'; > > Michael. > >> >> Il mer 3 giu 2020, 15:55 Michael Van Canneyt ha >> scritto: >> >>> >>> >>> On Wed, 3 Jun 2020, Francesco Sammarco wrote: >>> >>>> sorry I don't understand, you say that just remove the lines where I >>>> specify the timezone ?! >>> >>> No, remove the >>> >>> start_e.dateTime := LocalTimeToUniversal(start_e.dateTime); >>> >>> I think it is not necessary if you set the timezone. >>> >>> Michael. >>> >>> >>>> >>>> Il mer 3 giu 2020, 14:51 Michael Van Canneyt > ha >>>> scritto: >>>> >>>>> >>>>> >>>>> On Wed, 3 Jun 2020, Francesco Sammarco via lazarus wrote: >>>>> >>>>>> Hi everyone, I have the following problem. I have a calendar > (Italian) >>> to >>>>>> sync with Google Calendar. With the following code I can work quite >>> well. >>>>>> If today (2020-06-03) I set a new appointment it is saved on google >>>>>> calendar on the right day and time, but if for example: always today >>> if I >>>>>> set an appointment for December 10, 2020 at 9 am, I find myself there >>>>>> appointment set on the right day but at 8 am. (So an hour behind) I >>> think >>>>>> it's due to the change between sunlight and daylight. Can anyone >>> explain >>>>> to >>>>>> me how to solve the problem? >>>>>> >>>>>> Thank you >>>>>> XinYiMan >>>>>> >>>>>> >>>>>> >>>>>> var >>>>>> start_e : TEventDateTime; >>>>>> end_e : TEventDateTime; >>>>>> Entry : TEvent; >>>>>> begin >>>>>> Entry := FCalendarAPI.EventsResource.Get(CalendarFindedId, >>>>>> my_id_app); >>>>>> >>>>>> start_e := TEventDateTime.Create(); >>>>>> end_e := TEventDateTime.Create(); >>>>>> >>>>>> start_e.dateTime := data_appuntamento; >>>>>> start_e.dateTime := >>>>>> LocalTimeToUniversal(start_e.dateTime); >>>>>> start_e.timeZone := 'Europe/Rome'; >>>>> >>>>> If you set the timzeone explicitly, I don't think you must do a >>>>> LocalTimeToUniversal, >>>>> I think the timezone is then automatically taken into account. As I >>>>> understand it you specify the timezone in dateTime or you set it in > the >>>>> timezone. >>>>> >>>>> Michael. >>>>> >>>> >>> >> >

Reply by email

Francesco Sammarco
to Michael Van Canneyt

I tested this way. But not run correctly. Who is the Google API creator?

Il giorno gio 4 giu 2020 alle ore 09:32 Michael Van Canneyt <

Show quoted text 177 lines
ha scritto: Hello, I'm afraid I am of no help here. I am not an expert on the google Calendar API... What you can try to do is set the calendar configuration to your timezone (Italy/Rome, I suppose) and do not provide any timezone information when you create your items. Michael. On Thu, 4 Jun 2020, Francesco Sammarco wrote: > if I change my code in this mode, and change Google Calendar configuration, > with Greenwich meridian, I see correct result on Google Calendar. But I'm > not on Greenwich meridian. > > > I edited the demo calendar. I added a button and inside I put the following > code. > > procedure TMainForm.Button1Click(Sender: TObject); > var > Entry : TEvent; > Insert : TEvent; > start_e : TEventDateTime; > end_e : TEventDateTime; > begin > if LBCalendars.ItemIndex<0 then > Exit; > > start_e := TEventDateTime.Create(); > end_e := TEventDateTime.Create(); > > start_e.dateTime := EncodeDateTime(2020,6,3,19,0,0,0); > start_e.timeZone := 'Europe/London'; > end_e.dateTime := IncHour(start_e.dateTime,2); > end_e.timeZone := 'Europe/London'; > > Entry := TEvent.Create(); > Entry.summary := 'My test'; > Entry.description := 'My test'; > Entry.location := 'My location'; > Entry.start := start_e; > Entry._end := end_e; > > Entry.guestsCanInviteOthers := false; > Entry.guestsCanSeeOtherGuests := false; > > Entry.colorId := ''; > > Insert := FCalendarAPI.EventsResource.Insert(FCurrentCalendar.id,Entry); > > SaveRefreshToken; > > > Entry.Free; > Entry:=nil; > > ShowMessage('Insert ' + Insert.id); > > Insert.Free; > Insert:=nil; > end; > > Il giorno mer 3 giu 2020 alle ore 15:59 Michael Van Canneyt < > > ha scritto: > >> >> >> On Wed, 3 Jun 2020, Francesco Sammarco wrote: >> >>> sorry and how do I set the date and time of the apartment ?! >> >> I would think this is sufficient: >> >> Entry := FCalendarAPI.EventsResource.Get(CalendarFindedId, my_id_app); >> start_e := TEventDateTime.Create(); >> end_e := TEventDateTime.Create(); >> start_e.dateTime := data_appuntamento; >> start_e.timeZone := 'Europe/Rome'; >> >> Michael. >> >>> >>> Il mer 3 giu 2020, 15:55 Michael Van Canneyt ha >>> scritto: >>> >>>> >>>> >>>> On Wed, 3 Jun 2020, Francesco Sammarco wrote: >>>> >>>>> sorry I don't understand, you say that just remove the lines where I >>>>> specify the timezone ?! >>>> >>>> No, remove the >>>> >>>> start_e.dateTime := LocalTimeToUniversal(start_e.dateTime); >>>> >>>> I think it is not necessary if you set the timezone. >>>> >>>> Michael. >>>> >>>> >>>>> >>>>> Il mer 3 giu 2020, 14:51 Michael Van Canneyt < > >> ha >>>>> scritto: >>>>> >>>>>> >>>>>> >>>>>> On Wed, 3 Jun 2020, Francesco Sammarco via lazarus wrote: >>>>>> >>>>>>> Hi everyone, I have the following problem. I have a calendar >> (Italian) >>>> to >>>>>>> sync with Google Calendar. With the following code I can work quite >>>> well. >>>>>>> If today (2020-06-03) I set a new appointment it is saved on google >>>>>>> calendar on the right day and time, but if for example: always today >>>> if I >>>>>>> set an appointment for December 10, 2020 at 9 am, I find myself there >>>>>>> appointment set on the right day but at 8 am. (So an hour behind) I >>>> think >>>>>>> it's due to the change between sunlight and daylight. Can anyone >>>> explain >>>>>> to >>>>>>> me how to solve the problem? >>>>>>> >>>>>>> Thank you >>>>>>> XinYiMan >>>>>>> >>>>>>> >>>>>>> >>>>>>> var >>>>>>> start_e : TEventDateTime; >>>>>>> end_e : TEventDateTime; >>>>>>> Entry : TEvent; >>>>>>> begin >>>>>>> Entry := FCalendarAPI.EventsResource.Get(CalendarFindedId, >>>>>>> my_id_app); >>>>>>> >>>>>>> start_e := TEventDateTime.Create(); >>>>>>> end_e := TEventDateTime.Create(); >>>>>>> >>>>>>> start_e.dateTime := data_appuntamento; >>>>>>> start_e.dateTime := >>>>>>> LocalTimeToUniversal(start_e.dateTime); >>>>>>> start_e.timeZone := 'Europe/Rome'; >>>>>> >>>>>> If you set the timzeone explicitly, I don't think you must do a >>>>>> LocalTimeToUniversal, >>>>>> I think the timezone is then automatically taken into account. As I >>>>>> understand it you specify the timezone in dateTime or you set it in >> the >>>>>> timezone. >>>>>> >>>>>> Michael. >>>>>> >>>>> >>>> >>> >> >

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lazarus-ide.org/pipermail/lazarus/attachments/20200604/38b000f6/attachment.html>

Reply by email

Michael Van Canneyt
to Francesco Sammarco
Francesco Sammarco wrote
I tested this way. But not run correctly. Who is the Google API creator?

Google of course.

This is not a problem of the FPC API.
The API just tranfers data in a typesafe manner:
All it does is give you a way to create and interpret the JSON in a typesafe manner.

It does not know or care how Google interprets the data you send, this you need to ask on Google forums or stackoverflow or somesuch.

Michael.

Reply by email

Francesco Sammarco
to Michael Van Canneyt

If anyone cares I think I have found a working way. Basically I do the insertion or updating of the appointment. The API returns the content of the newly updated or inserted appointment, I compare the hours contained with the hours I wanted to set. I calculate the difference and apply it. I make a second update with the correct date / time. I know it's not elegant, but for the moment it seems the only working way.

Il giorno gio 4 giu 2020 alle ore 10:13 Michael Van Canneyt via lazarus <

Show quoted text 25 lines
ha scritto: On Thu, 4 Jun 2020, Francesco Sammarco wrote: > I tested this way. But not run correctly. Who is the Google API creator? Google of course. This is not a problem of the FPC API. The API just tranfers data in a typesafe manner: All it does is give you a way to create and interpret the JSON in a typesafe manner. It does not know or care how Google interprets the data you send, this you need to ask on Google forums or stackoverflow or somesuch. Michael. -- _______________________________________________ lazarus mailing list https://lists.lazarus-ide.org/listinfo/lazarus

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lazarus-ide.org/pipermail/lazarus/attachments/20200604/ed205e42/attachment.html>

Reply by email

Unknown author
to Francesco Sammarco
Francesco Sammarco wrote 6 lines
If anyone cares I think I have found a working way. Basically I do the insertion or updating of the appointment. The API returns the content of the newly updated or inserted appointment, I compare the hours contained with the hours I wanted to set. I calculate the difference and apply it. I make a second update with the correct date / time. I know it's not elegant, but for the moment it seems the only working way.

can you not determine if your desired time is in the daylight saving tim eperiod and adjust it as needed before you do the first posting to the calendar? i was going to suggest that yesterday when i first read of your plight but i wanted to wait and see what others might suggest...

so basically:

1. you decide your time and date...
2. check if it is within the daylight saving time period for your area... 2a. if #2 is yes, adjust the time as needed...
2b. if #2 is no, leave the time as originally set...
3. publish the appointment/event in the calendar...
4. done ;)

NOTE: No off-list assistance is given without prior approval. *Please keep mailing list traffic on the list where it belongs!*

Reply by email

Francesco Sammarco
to Unknown author

Of course, it's just not the idea of how to check if the time falls in daylight saving time or not.

Il giorno gio 4 giu 2020 alle ore 17:24 wkitty42--- via lazarus <

Show quoted text 43 lines
ha scritto: On 6/4/20 10:37 AM, Francesco Sammarco via lazarus wrote: > If anyone cares I think I have found a working way. Basically I do the insertion > or updating of the appointment. The API returns the content of the newly updated > or inserted appointment, I compare the hours contained with the hours I wanted > to set. I calculate the difference and apply it. I make a second update with the > correct date / time. I know it's not elegant, but for the moment it seems the > only working way. can you not determine if your desired time is in the daylight saving tim eperiod and adjust it as needed before you do the first posting to the calendar? i was going to suggest that yesterday when i first read of your plight but i wanted to wait and see what others might suggest... so basically: 1. you decide your time and date... 2. check if it is within the daylight saving time period for your area... 2a. if #2 is yes, adjust the time as needed... 2b. if #2 is no, leave the time as originally set... 3. publish the appointment/event in the calendar... 4. done ;) -- NOTE: No off-list assistance is given without prior approval. *Please keep mailing list traffic on the list where it belongs!* -- _______________________________________________ lazarus mailing list https://lists.lazarus-ide.org/listinfo/lazarus

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lazarus-ide.org/pipermail/lazarus/attachments/20200605/631c30d2/attachment-0001.html>

Reply by email

Unknown author
to Francesco Sammarco
Francesco Sammarco wrote
Of course, it's just not the idea of how to check if the time falls in daylight saving time or not.

why not? that is the problem and apparently the API and/or backend code at google don't handle it so the creator of the event/appointment must...

Show quoted text 43 lines
Il giorno gio 4 giu 2020 alle ore 17:24 wkitty42--- via lazarus < <mailto:>> ha scritto: On 6/4/20 10:37 AM, Francesco Sammarco via lazarus wrote: > If anyone cares I think I have found a working way. Basically I do the insertion > or updating of the appointment. The API returns the content of the newly updated > or inserted appointment, I compare the hours contained with the hours I wanted > to set. I calculate the difference and apply it. I make a second update with the > correct date / time. I know it's not elegant, but for the moment it seems the > only working way. can you not determine if your desired time is in the daylight saving tim eperiod and adjust it as needed before you do the first posting to the calendar? i was going to suggest that yesterday when i first read of your plight but i wanted to wait and see what others might suggest... so basically: 1. you decide your time and date... 2. check if it is within the daylight saving time period for your area... 2a. if #2 is yes, adjust the time as needed... 2b. if #2 is no, leave the time as originally set... 3. publish the appointment/event in the calendar... 4. done ;) --   NOTE: No off-list assistance is given without prior approval.         *Please keep mailing list traffic on the list where it belongs!* -- _______________________________________________ lazarus mailing list <mailto:> https://lists.lazarus-ide.org/listinfo/lazarus
NOTE: No off-list assistance is given without prior approval. *Please keep mailing list traffic on the list where it belongs!*

Reply by email

Francesco Sammarco
to Unknown author

Ok. But not so how to do it. Is there an example?

Il giorno ven 5 giu 2020 alle ore 13:54 wkitty42--- via lazarus <

Show quoted text 77 lines
ha scritto: On 6/5/20 2:04 AM, Francesco Sammarco wrote: > Of course, it's just not the idea of how to check if the time falls in daylight > saving time or not. why not? that is the problem and apparently the API and/or backend code at google don't handle it so the creator of the event/appointment must... > Il giorno gio 4 giu 2020 alle ore 17:24 wkitty42--- via lazarus > < <mailto:>> ha scritto: > > On 6/4/20 10:37 AM, Francesco Sammarco via lazarus wrote: > > If anyone cares I think I have found a working way. Basically I do the > insertion > > or updating of the appointment. The API returns the content of the newly > updated > > or inserted appointment, I compare the hours contained with the hours I > wanted > > to set. I calculate the difference and apply it. I make a second update > with the > > correct date / time. I know it's not elegant, but for the moment it seems > the > > only working way. > > > can you not determine if your desired time is in the daylight saving tim > eperiod > and adjust it as needed before you do the first posting to the calendar? i was > going to suggest that yesterday when i first read of your plight but i > wanted to > wait and see what others might suggest... > > so basically: > > 1. you decide your time and date... > 2. check if it is within the daylight saving time period for your area... > 2a. if #2 is yes, adjust the time as needed... > 2b. if #2 is no, leave the time as originally set... > 3. publish the appointment/event in the calendar... > 4. done ;) > > > -- > NOTE: No off-list assistance is given without prior approval. > *Please keep mailing list traffic on the list where it belongs!* > -- > _______________________________________________ > lazarus mailing list > <mailto:> > https://lists.lazarus-ide.org/listinfo/lazarus > -- NOTE: No off-list assistance is given without prior approval. *Please keep mailing list traffic on the list where it belongs!* -- _______________________________________________ lazarus mailing list https://lists.lazarus-ide.org/listinfo/lazarus

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lazarus-ide.org/pipermail/lazarus/attachments/20200605/e041f461/attachment.html>

Reply by email

John Landmesser
to Francesco Sammarco

As Example for Germany:

https://wiki.freepascal.org/Daylight_saving_time/de

Francesco Sammarco wrote 89 lines
Ok. But not so how to do it. Is there an example? Il giorno ven 5 giu 2020 alle ore 13:54 wkitty42--- via lazarus < <mailto:>> ha scritto: On 6/5/20 2:04 AM, Francesco Sammarco wrote: > Of course, it's just not the idea of how to check if the time falls in daylight > saving time or not. why not? that is the problem and apparently the API and/or backend code at google don't handle it so the creator of the event/appointment must... > Il giorno gio 4 giu 2020 alle ore 17:24 wkitty42--- via lazarus > < <mailto:> <mailto: <mailto:>>> ha scritto: > >     On 6/4/20 10:37 AM, Francesco Sammarco via lazarus wrote: >      > If anyone cares I think I have found a working way. Basically I do the >     insertion >      > or updating of the appointment. The API returns the content of the newly >     updated >      > or inserted appointment, I compare the hours contained with the hours I >     wanted >      > to set. I calculate the difference and apply it. I make a second update >     with the >      > correct date / time. I know it's not elegant, but for the moment it seems >     the >      > only working way. > > >     can you not determine if your desired time is in the daylight saving tim >     eperiod >     and adjust it as needed before you do the first posting to the calendar? i was >     going to suggest that yesterday when i first read of your plight but i >     wanted to >     wait and see what others might suggest... > >     so basically: > >     1. you decide your time and date... >     2. check if it is within the daylight saving time period for your area... >     2a. if #2 is yes, adjust the time as needed... >     2b. if #2 is no, leave the time as originally set... >     3. publish the appointment/event in the calendar... >     4. done ;) > > >     -- >        NOTE: No off-list assistance is given without prior approval. >              *Please keep mailing list traffic on the list where it belongs!* >     -- >     _______________________________________________ >     lazarus mailing list > <mailto:> <mailto: <mailto:>> > https://lists.lazarus-ide.org/listinfo/lazarus > --   NOTE: No off-list assistance is given without prior approval.         *Please keep mailing list traffic on the list where it belongs!* -- _______________________________________________ lazarus mailing list <mailto:> https://lists.lazarus-ide.org/listinfo/lazarus

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lazarus-ide.org/pipermail/lazarus/attachments/20200605/4b7d50c6/attachment-0001.html>

Reply by email

Francesco Sammarco
to John Landmesser

Sorry but I knew it is not wise to implement it like this, because being a political choice it can change from year to year. But if there is no alternative, I will proceed on that road too.

Il giorno ven 5 giu 2020 alle ore 14:04 John Landmesser via lazarus <

Show quoted text 106 lines
ha scritto: As Example for Germany: https://wiki.freepascal.org/Daylight_saving_time/de Am 05.06.20 um 14:00 schrieb Francesco Sammarco via lazarus: Ok. But not so how to do it. Is there an example? Il giorno ven 5 giu 2020 alle ore 13:54 wkitty42--- via lazarus < > ha scritto: > On 6/5/20 2:04 AM, Francesco Sammarco wrote: > > Of course, it's just not the idea of how to check if the time falls in > daylight > > saving time or not. > > > why not? that is the problem and apparently the API and/or backend code > at > google don't handle it so the creator of the event/appointment must... > > > > Il giorno gio 4 giu 2020 alle ore 17:24 wkitty42--- via lazarus > > < <mailto:>> > ha scritto: > > > > On 6/4/20 10:37 AM, Francesco Sammarco via lazarus wrote: > > > If anyone cares I think I have found a working way. Basically I > do the > > insertion > > > or updating of the appointment. The API returns the content of > the newly > > updated > > > or inserted appointment, I compare the hours contained with the > hours I > > wanted > > > to set. I calculate the difference and apply it. I make a second > update > > with the > > > correct date / time. I know it's not elegant, but for the moment > it seems > > the > > > only working way. > > > > > > can you not determine if your desired time is in the daylight > saving tim > > eperiod > > and adjust it as needed before you do the first posting to the > calendar? i was > > going to suggest that yesterday when i first read of your plight > but i > > wanted to > > wait and see what others might suggest... > > > > so basically: > > > > 1. you decide your time and date... > > 2. check if it is within the daylight saving time period for your > area... > > 2a. if #2 is yes, adjust the time as needed... > > 2b. if #2 is no, leave the time as originally set... > > 3. publish the appointment/event in the calendar... > > 4. done ;) > > > > > > -- > > NOTE: No off-list assistance is given without prior approval. > > *Please keep mailing list traffic on the list where it > belongs!* > > -- > > _______________________________________________ > > lazarus mailing list > > <mailto: > > > > https://lists.lazarus-ide.org/listinfo/lazarus > > > > > -- > NOTE: No off-list assistance is given without prior approval. > *Please keep mailing list traffic on the list where it belongs!* > -- > _______________________________________________ > lazarus mailing list > > https://lists.lazarus-ide.org/listinfo/lazarus > -- _______________________________________________ lazarus mailing list https://lists.lazarus-ide.org/listinfo/lazarus

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lazarus-ide.org/pipermail/lazarus/attachments/20200605/2bff2319/attachment.html>

Reply by email

Marcello
to Francesco Sammarco

AFAIK, from 2010, in Italy dayligth starts on last sunday of march and ends the last sunday of october

nomorelogic

Il 05/06/20 15:57, Francesco Sammarco via lazarus ha scritto:

Show quoted text 12 lines
Sorry but I knew it is not wise to implement it like this, because being a political choice it can change from year to year. But if there is no alternative, I will proceed on that road too. Il giorno ven 5 giu 2020 alle ore 14:04 John Landmesser via lazarus < <mailto:>> ha scritto: As Example for Germany: https://wiki.freepascal.org/Daylight_saving_time/de

Reply by email