Fix parsing todoist reminder dates
(cherry picked from commit 78791f31a4
)
This commit is contained in:
parent
75f95e2afc
commit
960258a8c2
2 changed files with 20 additions and 12 deletions
|
@ -283,7 +283,7 @@ func convertTodoistToVikunja(sync *sync) (fullVikunjaHierachie []*models.Namespa
|
||||||
|
|
||||||
// Put the due date together
|
// Put the due date together
|
||||||
if i.Due != nil {
|
if i.Due != nil {
|
||||||
dueDate, err := time.Parse("2006-01-02T15:04:05Z", i.Due.Date)
|
dueDate, err := time.Parse("2006-01-02", i.Due.Date)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
@ -368,7 +368,15 @@ func convertTodoistToVikunja(sync *sync) (fullVikunjaHierachie []*models.Namespa
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
date, err := time.Parse("2006-01-02", r.Due.Date)
|
var err error
|
||||||
|
var date time.Time
|
||||||
|
date, err = time.Parse("2006-01-02T15:04:05Z", r.Due.Date)
|
||||||
|
if err != nil {
|
||||||
|
date, err = time.Parse("2006-01-02T15:04:05", r.Due.Date)
|
||||||
|
}
|
||||||
|
if err != nil {
|
||||||
|
date, err = time.Parse("2006-01-02", r.Due.Date)
|
||||||
|
}
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
|
@ -274,7 +274,7 @@ func TestConvertTodoistToVikunja(t *testing.T) {
|
||||||
ID: 103001,
|
ID: 103001,
|
||||||
ItemID: 400000000,
|
ItemID: 400000000,
|
||||||
Due: &dueDate{
|
Due: &dueDate{
|
||||||
Date: "2020-06-16",
|
Date: "2020-06-16T07:00:00",
|
||||||
IsRecurring: false,
|
IsRecurring: false,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
@ -282,7 +282,7 @@ func TestConvertTodoistToVikunja(t *testing.T) {
|
||||||
ID: 103002,
|
ID: 103002,
|
||||||
ItemID: 400000002,
|
ItemID: 400000002,
|
||||||
Due: &dueDate{
|
Due: &dueDate{
|
||||||
Date: "2020-07-15",
|
Date: "2020-07-15T07:00:00Z",
|
||||||
IsRecurring: true,
|
IsRecurring: true,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
@ -290,7 +290,7 @@ func TestConvertTodoistToVikunja(t *testing.T) {
|
||||||
ID: 103003,
|
ID: 103003,
|
||||||
ItemID: 400000003,
|
ItemID: 400000003,
|
||||||
Due: &dueDate{
|
Due: &dueDate{
|
||||||
Date: "2020-06-15",
|
Date: "2020-06-15T07:00:00",
|
||||||
IsRecurring: false,
|
IsRecurring: false,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
@ -298,7 +298,7 @@ func TestConvertTodoistToVikunja(t *testing.T) {
|
||||||
ID: 103004,
|
ID: 103004,
|
||||||
ItemID: 400000005,
|
ItemID: 400000005,
|
||||||
Due: &dueDate{
|
Due: &dueDate{
|
||||||
Date: "2020-06-15",
|
Date: "2020-06-15T07:00:00",
|
||||||
IsRecurring: false,
|
IsRecurring: false,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
@ -306,7 +306,7 @@ func TestConvertTodoistToVikunja(t *testing.T) {
|
||||||
ID: 103006,
|
ID: 103006,
|
||||||
ItemID: 400000009,
|
ItemID: 400000009,
|
||||||
Due: &dueDate{
|
Due: &dueDate{
|
||||||
Date: "2020-06-15",
|
Date: "2020-06-15T07:00:00",
|
||||||
IsRecurring: false,
|
IsRecurring: false,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
@ -350,7 +350,7 @@ func TestConvertTodoistToVikunja(t *testing.T) {
|
||||||
Created: time1,
|
Created: time1,
|
||||||
Reminders: []time.Time{
|
Reminders: []time.Time{
|
||||||
time.Date(2020, time.June, 15, 0, 0, 0, 0, time.UTC).In(config.GetTimeZone()),
|
time.Date(2020, time.June, 15, 0, 0, 0, 0, time.UTC).In(config.GetTimeZone()),
|
||||||
time.Date(2020, time.June, 16, 0, 0, 0, 0, time.UTC).In(config.GetTimeZone()),
|
time.Date(2020, time.June, 16, 7, 0, 0, 0, time.UTC).In(config.GetTimeZone()),
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
@ -364,7 +364,7 @@ func TestConvertTodoistToVikunja(t *testing.T) {
|
||||||
Done: false,
|
Done: false,
|
||||||
Created: time1,
|
Created: time1,
|
||||||
Reminders: []time.Time{
|
Reminders: []time.Time{
|
||||||
time.Date(2020, time.July, 15, 0, 0, 0, 0, time.UTC).In(config.GetTimeZone()),
|
time.Date(2020, time.July, 15, 7, 0, 0, 0, time.UTC).In(config.GetTimeZone()),
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
@ -376,7 +376,7 @@ func TestConvertTodoistToVikunja(t *testing.T) {
|
||||||
DoneAt: time3,
|
DoneAt: time3,
|
||||||
Labels: vikunjaLabels,
|
Labels: vikunjaLabels,
|
||||||
Reminders: []time.Time{
|
Reminders: []time.Time{
|
||||||
time.Date(2020, time.June, 15, 0, 0, 0, 0, time.UTC).In(config.GetTimeZone()),
|
time.Date(2020, time.June, 15, 7, 0, 0, 0, time.UTC).In(config.GetTimeZone()),
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
@ -392,7 +392,7 @@ func TestConvertTodoistToVikunja(t *testing.T) {
|
||||||
Created: time1,
|
Created: time1,
|
||||||
DoneAt: time3,
|
DoneAt: time3,
|
||||||
Reminders: []time.Time{
|
Reminders: []time.Time{
|
||||||
time.Date(2020, time.June, 15, 0, 0, 0, 0, time.UTC).In(config.GetTimeZone()),
|
time.Date(2020, time.June, 15, 7, 0, 0, 0, time.UTC).In(config.GetTimeZone()),
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
@ -470,7 +470,7 @@ func TestConvertTodoistToVikunja(t *testing.T) {
|
||||||
Done: false,
|
Done: false,
|
||||||
Created: time1,
|
Created: time1,
|
||||||
Reminders: []time.Time{
|
Reminders: []time.Time{
|
||||||
time.Date(2020, time.June, 15, 0, 0, 0, 0, time.UTC).In(config.GetTimeZone()),
|
time.Date(2020, time.June, 15, 7, 0, 0, 0, time.UTC).In(config.GetTimeZone()),
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue