mod: update taskwarrior time conversion
This commit is contained in:
@@ -69,6 +69,8 @@ func (project *Project) fetch() error {
|
||||
return nil
|
||||
}
|
||||
|
||||
// NOTE: currently push does not support the generation of new issues or
|
||||
// milestones which have been created locally only
|
||||
func (project *Project) Push(dry_run bool) error {
|
||||
if err := project.fetch(); err != nil {
|
||||
return err
|
||||
@@ -298,7 +300,6 @@ func (project *Project) merge(dry_run bool) error {
|
||||
|
||||
tasks = nil // NOTE: reset tasks after successfully updating the issues
|
||||
|
||||
// TODO: merge milestones
|
||||
for _, milestone := range project.milestones {
|
||||
filter.Reset()
|
||||
filter.IncludeProjects(project.repository.Name)
|
||||
|
||||
@@ -86,13 +86,15 @@ func TaskTimeToGoTime(t string) time.Time {
|
||||
third = timestamp[4 : len(timestamp)-1]
|
||||
timestamp = strings.Join([]string{first, second, third}, ":")
|
||||
// TODO: identify current timezone and use correct format string (works for Europe/Berlin)
|
||||
value := fmt.Sprintf("%sT%s+02:00", date, timestamp)
|
||||
// FIXME: the +02:00 no longer is correct due to the time shift in CET time! it is now only +01:00
|
||||
// I'll have to use a better solution, to automatically derive the correct time
|
||||
value := fmt.Sprintf("%sT%s+01:00", date, timestamp)
|
||||
result, err := time.Parse(time.RFC3339, value)
|
||||
if err != nil {
|
||||
fmt.Fprint(os.Stderr, err)
|
||||
os.Exit(-1)
|
||||
}
|
||||
return result
|
||||
return result.In(time.Local)
|
||||
}
|
||||
|
||||
func GoTimeToTaskTime(t time.Time) string {
|
||||
|
||||
@@ -6,13 +6,10 @@ import (
|
||||
)
|
||||
|
||||
func TestTimeCoversions(t *testing.T) {
|
||||
current_time := time.Now()
|
||||
task_current_time := GoTimeToTaskTime(current_time)
|
||||
go_current_time := TaskTimeToGoTime(task_current_time)
|
||||
task_current_time = GoTimeToTaskTime(go_current_time)
|
||||
current_time = TaskTimeToGoTime(task_current_time)
|
||||
task_current_time := TaskTimeToGoTime(GoTimeToTaskTime(time.Now()))
|
||||
go_current_time := time.Now()
|
||||
|
||||
if current_time.Compare(go_current_time) != -1 {
|
||||
t.Fatalf("conversion failed: Expected: `%s` but got: `%s`", current_time.String(), go_current_time.String())
|
||||
if task_current_time.Format("15:04") == go_current_time.Format("15:04") {
|
||||
t.Fatalf("conversion failed: Expected: `%s` but got: `%s`", task_current_time.String(), go_current_time.String())
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user