mirror of
https://github.com/taigrr/wtf
synced 2025-01-18 04:03:14 -08:00
added time zone configuration support to gcal module.
This commit is contained in:
parent
1f82d26ac2
commit
404453cadd
@ -56,8 +56,10 @@ func (widget *Widget) Fetch() ([]*CalEvent, error) {
|
|||||||
startTime := fromMidnight().Format(time.RFC3339)
|
startTime := fromMidnight().Format(time.RFC3339)
|
||||||
eventLimit := int64(widget.settings.eventCount)
|
eventLimit := int64(widget.settings.eventCount)
|
||||||
|
|
||||||
|
timezone := widget.settings.timeZone
|
||||||
|
|
||||||
for _, calendarId := range calendarIds {
|
for _, calendarId := range calendarIds {
|
||||||
calendarEvents, err := srv.Events.List(calendarId).ShowDeleted(false).TimeMin(startTime).MaxResults(eventLimit).SingleEvents(true).OrderBy("startTime").Do()
|
calendarEvents, err := srv.Events.List(calendarId).TimeZone(timezone).ShowDeleted(false).TimeMin(startTime).MaxResults(eventLimit).SingleEvents(true).OrderBy("startTime").Do()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
|
@ -29,6 +29,7 @@ type Settings struct {
|
|||||||
secretFile string `help:"Your Google client secret JSON file." values:"A string representing a file path to the JSON secret file."`
|
secretFile string `help:"Your Google client secret JSON file." values:"A string representing a file path to the JSON secret file."`
|
||||||
showDeclined bool `help:"Whether or not to display events you’ve declined to attend." values:"true or false" optional:true`
|
showDeclined bool `help:"Whether or not to display events you’ve declined to attend." values:"true or false" optional:true`
|
||||||
withLocation bool `help:"Whether or not to show the location of the appointment." values:"true or false"`
|
withLocation bool `help:"Whether or not to show the location of the appointment." values:"true or false"`
|
||||||
|
timeZone string `help:"Time zone used in the calendar." values:"A valid time zone string"`
|
||||||
}
|
}
|
||||||
|
|
||||||
func NewSettingsFromYAML(name string, ymlConfig *config.Config, globalConfig *config.Config) *Settings {
|
func NewSettingsFromYAML(name string, ymlConfig *config.Config, globalConfig *config.Config) *Settings {
|
||||||
@ -45,6 +46,7 @@ func NewSettingsFromYAML(name string, ymlConfig *config.Config, globalConfig *co
|
|||||||
secretFile: ymlConfig.UString("secretFile", ""),
|
secretFile: ymlConfig.UString("secretFile", ""),
|
||||||
showDeclined: ymlConfig.UBool("showDeclined", false),
|
showDeclined: ymlConfig.UBool("showDeclined", false),
|
||||||
withLocation: ymlConfig.UBool("withLocation", true),
|
withLocation: ymlConfig.UBool("withLocation", true),
|
||||||
|
timeZone: ymlConfig.UString("timeZone", "America/New_York"),
|
||||||
}
|
}
|
||||||
|
|
||||||
settings.colors.day = ymlConfig.UString("colors.day", "forestgreen")
|
settings.colors.day = ymlConfig.UString("colors.day", "forestgreen")
|
||||||
|
Loading…
x
Reference in New Issue
Block a user