diff --git a/README.md b/README.md index e3e3830..ff0afe7 100644 --- a/README.md +++ b/README.md @@ -12,6 +12,10 @@ flag `-h`. $ ./unizar-calendar -h +In case you generate for Google Calendar, make sure to create a new +calendar with the correct timezone before importing. To import a csv +file as a calendar, check [this guide](https://support.google.com/calendar/answer/37118?co=GENIE.Platform%3DDesktop&hl=en). + ## Compile Compilation is automatic thanks to Go modules. That means you have to diff --git a/internal/exports/gcal.go b/internal/exports/gcal.go index ff36823..8924448 100644 --- a/internal/exports/gcal.go +++ b/internal/exports/gcal.go @@ -3,7 +3,6 @@ package exports import ( "fmt" "strings" - "time" "github.com/xzebra/unizar-calendar/internal/semester" ) @@ -11,9 +10,8 @@ import ( const ( gcalCSVSeparator = "," gcalCSVDateFormat = "2006-01-02" - gcalCSVTimeFormat = "03:04:05 PM" + gcalCSVTimeFormat = "15:04" gcalCSVPrivate = "False" - utcFix = -time.Hour ) var gcalCSVHeader = strings.Join([]string{ @@ -41,13 +39,13 @@ func toGcal(s *semester.Data) string { // Subject out.WriteString(fmt.Sprintf("\"%s\"%s", name, gcalCSVSeparator)) // Start Date - out.WriteString(time.Start.Add(utcFix).Format(gcalCSVDateFormat) + gcalCSVSeparator) + out.WriteString(time.Start.Format(gcalCSVDateFormat) + gcalCSVSeparator) // Start Time - out.WriteString(time.Start.Add(utcFix).Format(gcalCSVTimeFormat) + gcalCSVSeparator) + out.WriteString(time.Start.Format(gcalCSVTimeFormat) + gcalCSVSeparator) // End Date - out.WriteString(time.End.Add(utcFix).Format(gcalCSVDateFormat) + gcalCSVSeparator) + out.WriteString(time.End.Format(gcalCSVDateFormat) + gcalCSVSeparator) // End Time - out.WriteString(time.End.Add(utcFix).Format(gcalCSVTimeFormat) + gcalCSVSeparator) + out.WriteString(time.End.Format(gcalCSVTimeFormat) + gcalCSVSeparator) // Description out.WriteString(fmt.Sprintf("\"%s\"%s", desc, gcalCSVSeparator)) // Private