1
0

fix: importing tasks from todoist without a due time set

Resolves #897
This commit is contained in:
kolaente
2021-11-23 22:29:53 +01:00
parent 86480ad969
commit fd0d462bf4
2 changed files with 11 additions and 2 deletions

View File

@ -241,6 +241,15 @@ func (m *Migration) AuthURL() string {
}
func parseDate(dateString string) (date time.Time, err error) {
if len(dateString) == 10 {
// We're probably dealing with a date in the form of 2021-11-23 without a time
date, err = time.Parse("2006-01-02", dateString)
if err == nil {
// round the day to eod
return date.Add(time.Hour*23 + time.Minute*59), nil
}
}
date, err = time.Parse("2006-01-02T15:04:05Z", dateString)
if err != nil {
date, err = time.Parse("2006-01-02T15:04:05", dateString)