summaryrefslogtreecommitdiff
path: root/internal/tui
diff options
context:
space:
mode:
authorT <t@tjp.lol>2025-08-08 10:57:56 -0600
committerT <t@tjp.lol>2025-08-12 14:45:56 -0600
commitdaea67322cd387c2caf8f1a326c90b4276c6e9bc (patch)
treeda1d2a85e530640a1ed804fece38da30940e7dd5 /internal/tui
parent54c791927b2851fb6739ed75897090c3c39ecca1 (diff)
bugfixes
Diffstat (limited to 'internal/tui')
-rw-r--r--internal/tui/app.go4
-rw-r--r--internal/tui/history_box.go2
-rw-r--r--internal/tui/modal.go10
-rw-r--r--internal/tui/shared.go6
4 files changed, 10 insertions, 12 deletions
diff --git a/internal/tui/app.go b/internal/tui/app.go
index 0caf571..6765cd1 100644
--- a/internal/tui/app.go
+++ b/internal/tui/app.go
@@ -203,9 +203,9 @@ func (m *AppModel) openEntryEditor() {
f.fields[0].Focus()
entry := m.historyBox.selectedEntry()
- f.fields[0].SetValue(entry.StartTime.Format(time.DateTime))
+ f.fields[0].SetValue(entry.StartTime.Local().Format(time.DateTime))
if entry.EndTime.Valid {
- f.fields[1].SetValue(entry.EndTime.Time.Format(time.DateTime))
+ f.fields[1].SetValue(entry.EndTime.Time.Local().Format(time.DateTime))
}
for _, client := range m.projectsBox.clients {
if client.ID == entry.ClientID {
diff --git a/internal/tui/history_box.go b/internal/tui/history_box.go
index 00b39f3..d2f71f9 100644
--- a/internal/tui/history_box.go
+++ b/internal/tui/history_box.go
@@ -247,7 +247,7 @@ func (m HistoryBoxModel) renderSummaryView(timer TimerBoxModel) string {
var activeKey HistorySummaryKey
if timer.timerInfo.IsActive {
activeKey = HistorySummaryKey{
- Date: dateOnly(timer.timerInfo.StartTime),
+ Date: dateOnly(timer.timerInfo.StartTime.Local()),
ClientID: timer.timerInfo.ClientID,
}
if timer.timerInfo.ProjectID != nil {
diff --git a/internal/tui/modal.go b/internal/tui/modal.go
index 167b659..9a72336 100644
--- a/internal/tui/modal.go
+++ b/internal/tui/modal.go
@@ -92,7 +92,7 @@ func (m ModalBoxModel) Render() string {
func (m ModalBoxModel) RenderFormModal(title string) string {
return fmt.Sprintf(
- "%s\n\n%s\n\n%s Delete %s Cancel",
+ "%s\n\n%s\n\n%s Submit %s Cancel",
modalTitleStyle.Render(title),
m.form.View(),
boldStyle.Render("[Enter]"),
@@ -231,22 +231,22 @@ func (m *ModalBoxModel) validateAndParseEntryForm(am AppModel) (queries.EditTime
entry, _ := am.queries.GetTimeEntryById(context.Background(), params.EntryID)
startTimeStr := m.form.fields[0].Value()
- startTime, err := time.Parse(time.DateTime, startTimeStr)
+ startTime, err := time.ParseInLocation(time.DateTime, startTimeStr, time.Local)
if err != nil {
m.form.fields[0].Err = fmt.Errorf("invalid start time format")
hasErrors = true
} else {
- params.StartTime = startTime
+ params.StartTime = startTime.UTC().Format(time.DateTime)
}
endTimeStr := m.form.fields[1].Value()
if endTimeStr != "" {
- endTime, err := time.Parse(time.DateTime, endTimeStr)
+ endTime, err := time.ParseInLocation(time.DateTime, endTimeStr, time.Local)
if err != nil {
m.form.fields[1].Err = fmt.Errorf("invalid end time format")
hasErrors = true
} else {
- params.EndTime = sql.NullTime{Time: endTime, Valid: true}
+ params.EndTime = endTime.UTC().Format(time.DateTime)
}
} else if entry.EndTime.Valid {
m.form.fields[1].Err = fmt.Errorf("can not re-open an entry")
diff --git a/internal/tui/shared.go b/internal/tui/shared.go
index 0b0a8c2..e0ee9a0 100644
--- a/internal/tui/shared.go
+++ b/internal/tui/shared.go
@@ -132,9 +132,7 @@ func RenderTopBar(m AppModel) string {
week += activeTime
}
- right := fmt.Sprintf("Today: %s | Week: %s",
- FormatDuration(today),
- FormatDuration(week))
+ right := fmt.Sprintf("Today: %s | Week: %s", FormatDuration(today), FormatDuration(week))
// Use lipgloss to create left and right aligned content
leftStyle := lipgloss.NewStyle().Align(lipgloss.Left)
@@ -237,7 +235,7 @@ func getAppData(
return
}
- now := time.Now()
+ now := time.Now().UTC()
todayY, todayM, todayD := now.Date()
lastMon := mostRecentMonday(now)
inDay := true