omz / Pythonista-Issues

Issue tracker for Pythonista (iOS)
169 stars 14 forks source link

Strange due date setting in reminders module in some time zones #182

Open j1wan opened 8 years ago

j1wan commented 8 years ago

I live in Seoul, South Korea which corresponds to GMT+9 (Asia/Seoul). Working with the reminders module, I found very strange due date behavior. If I run the following Pythonista 3 script, the second Reminder item falls into Tomorrow, like the following image. Actually, in GMT+9, before 15:00 is classified as today and after 15:00 is classified as tomorrow. And removing the second reminder make Reminders app to crash.

import reminders, webbrowser
from datetime import datetime

r = reminders.Reminder()
a = reminders.Alarm()
r.due_date = a.date = datetime.now().replace(hour=14)
r.alarms = [a]
r.title = 'GMT+9 Today 14:xx:xx'
r.save()

r = reminders.Reminder()
a = reminders.Alarm()
r.due_date = a.date = datetime.now().replace(hour=15)
r.alarms = [a]
r.title = 'GMT+9 Today 15:xx:xx'
r.save()

webbrowser.open('x-apple-reminder://')

However, in other GMTs, for example in New York of GMT-4, there is no such problem. If I change my iPhone's timezone to New York and run the following script, the date is correct.

import reminders, webbrowser
from datetime import datetime, timedelta

r = reminders.Reminder()
a = reminders.Alarm()
r.due_date = a.date = datetime.now().replace(hour=0)
r.alarms = [a]
r.title = 'GMT-4 Today 00:xx:xx'
r.save()

r = reminders.Reminder()
a = reminders.Alarm()
r.due_date = a.date = datetime.now().replace(hour=23)
r.alarms = [a]
r.title = 'GMT-4 Today 23:xx:xx'
r.save()

webbrowser.open('x-apple-reminder://')

img_1024

I couldn't check all the time zones, but it seems obvious that at least 'Asia/Seoul' timezone has such problems. Can you fix this?

controversial commented 8 years ago

Are you sure this is a problem with Pythonista and not a problem with Reminders?

j1wan commented 8 years ago

I think it is a problem of Pythonista's reminders module. Because when I tried the same task in Workflow or Fantastical x-callback-url, there were no such problems at all. Also when I create reminder items using Reminders app directly, it works just fine.

zrzka commented 7 years ago

@j1wan still encountering this issue these days?

j1wan commented 7 years ago

@zrzka Yes, it is still problem. I think it might because Pythonista uses old version of Reminders API.