mmagnus / garmin2calendar

garmin2calendar - Send your Garmin activities to Calendar (on macOS)
1 stars 0 forks source link

Invalid date and time [on non-English macOS] #1

Open sisyphosloughs opened 4 years ago

sisyphosloughs commented 4 years ago

Hi,

thank you for the script! Due to the fact, that Garmin updates via Caldav somehow do not work, or is sending updates once per week, this is the only approach to include the activities in my calandar.

Unvortunatly I can't mange to make it run due to a conversion error.

~/bin/garmin2calendar/garmin2calendar.py --calendar 'Sport' -v ~/Nextcloud/_Appdata/garmin/2020-06-28T12:04:25+00:00_5157602325_summary.json
/Users/benjaminbrucker/Nextcloud/_Appdata/garmin/2020-06-28T12:04:25+00:00_5157602325_summary.json
--------------------------------------------------------------------------------

    tell application "Calendar"
    tell calendar "Sport"
        set theCurrentDate to (date "Sunday, June 28, 2020 02:04 PM")
        set EndDate to (date "Sunday, June 28, 2020 02:34 PM")
        make new event at end with properties {description:"", summary:"Sweeping 235 kcal 0/30 min (Sport)", start date:theCurrentDate, end date:EndDate}
    end tell
    reload calendars
    end tell
/tmp/garmin2calendar.scpt:87:124: script error: Datum und Uhrzeit sind ungültig: date Sunday, June 28, 2020 02:04 PM. (-30720)

The german text says Date and time are invalid:

So I think the problem is to write the data in the local format, which my geman MacOS is exprecting.

Would be nice, if you have any idea or work-a-round for that.

Antother thing is, the scripts does log this unseccessfull attempt. Maybe it would help, only to log the successfully imported activities.

Please ask me, if there is anything I can help you to improve that.

MacOS 10.15.5 (19F101) Python 3.7.7

mmagnus commented 4 years ago

OK, @sisyphosloughs I will take a look at that this week

sisyphosloughs commented 4 years ago

Great! Thank you for that!

Am 28.06.2020 um 16:36 schrieb Marcin Magnus notifications@github.com:

OK, @sisyphosloughs https://github.com/sisyphosloughs I will take a look at that this week

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/mmagnus/garmin2calendar/issues/1#issuecomment-650770666, or unsubscribe https://github.com/notifications/unsubscribe-auth/ACXJPILGIQLN52JCBQE437LRY5IPRANCNFSM4OKRMONA.

mmagnus commented 4 years ago

Yeah, the problem is how Apple Scripts convert to the date. I played a bit with this, not to use any English speaking words, but I failed to get the date and the time right. I was able to get the date...

Screen Shot 2020-07-07 at 5 48 43 PM

So the Python script has to be changed into some format that your Apple Script will accept as a correct string to be converted into date.

https://macscripter.net/viewtopic.php?id=24737

I don't have to do more for now... :(