diff --git a/config/config.go b/config/config.go index 075e64b..91b6ac1 100644 --- a/config/config.go +++ b/config/config.go @@ -40,6 +40,7 @@ type Config struct { Mouse bool `toml:"mouse"` Timestamps bool `toml:"timestamps"` MessagesLimit int `toml:"messages_limit"` + Timezone string `toml:"timezone"` AttachmentDownloadsDir string `toml:"attachment_downloads_dir"` Identify IdentifyConfig `toml:"identify"` Theme ThemeConfig `toml:"theme"` @@ -51,6 +52,7 @@ func New() *Config { Mouse: true, Timestamps: false, MessagesLimit: 50, + Timezone: "Local", AttachmentDownloadsDir: UserDownloadsDir(), Identify: IdentifyConfig{ UserAgent: "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/101.0.4951.67 Safari/537.36", diff --git a/ui/builder.go b/ui/builder.go index 98a7c8c..1938e79 100644 --- a/ui/builder.go +++ b/ui/builder.go @@ -24,8 +24,13 @@ func buildMessage(app *App, m *astatine.Message) []byte { buildReferencedMessage(&b, m.ReferencedMessage, app.Session.State.User.ID) if app.Config.Timestamps { + loc, err := time.LoadLocation(app.Config.Timezone) + if err != nil { + return nil + } + b.WriteString("[::d]") - b.WriteString(m.Timestamp.Format(time.Stamp)) + b.WriteString(m.Timestamp.In(loc).Format(time.Stamp)) b.WriteString("[::-]") b.WriteByte(' ') }