Skip to content

Commit

Permalink
hotfix: revert gcal timezone hack
Browse files Browse the repository at this point in the history
  • Loading branch information
xzebra committed Feb 10, 2021
1 parent df1868e commit 71af303
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 7 deletions.
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
12 changes: 5 additions & 7 deletions internal/exports/gcal.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,15 @@ package exports
import (
"fmt"
"strings"
"time"

"github.com/xzebra/unizar-calendar/internal/semester"
)

const (
gcalCSVSeparator = ","
gcalCSVDateFormat = "2006-01-02"
gcalCSVTimeFormat = "03:04:05 PM"
gcalCSVTimeFormat = "15:04"
gcalCSVPrivate = "False"
utcFix = -time.Hour
)

var gcalCSVHeader = strings.Join([]string{
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 71af303

Please sign in to comment.