Switch all user-facing time displays to 12-hour MM-DD-YYYY format
Consistently format dates and times across all templates and API handlers using MM-DD-YYYY with 12-hour clock (03:04 PM): - analytics.go: date keys, lastSync, lastRead timestamps - progress.go: lastUpdated timestamp in GetAllProgress - book_detail.templ: LastReadAt, DatePublished - book_detail_modals.templ: progress sync timestamps, LastReadAt - devices.templ: LastSync, LastSeen - conflicts.templ: CreatedAt - admin_users.templ: user CreatedAt date
This commit is contained in:
@@ -75,18 +75,18 @@ func (h *AnalyticsHandler) GetReadingStats(c *echo.Context) error {
|
||||
endDate := c.QueryParam("end_date")
|
||||
|
||||
if startDate == "" {
|
||||
startDate = time.Now().AddDate(0, -1, 0).Format("2006-01-02")
|
||||
startDate = time.Now().AddDate(0, -1, 0).Format("01-02-2006")
|
||||
}
|
||||
if endDate == "" {
|
||||
endDate = time.Now().Format("2006-01-02")
|
||||
endDate = time.Now().Format("01-02-2006")
|
||||
}
|
||||
|
||||
startTime, err := time.Parse("2006-01-02", startDate)
|
||||
startTime, err := time.Parse("01-02-2006", startDate)
|
||||
if err != nil {
|
||||
return echo.NewHTTPError(http.StatusBadRequest, "invalid start_date format")
|
||||
}
|
||||
|
||||
endTime, err := time.Parse("2006-01-02", endDate)
|
||||
endTime, err := time.Parse("01-02-2006", endDate)
|
||||
if err != nil {
|
||||
return echo.NewHTTPError(http.StatusBadRequest, "invalid end_date format")
|
||||
}
|
||||
@@ -130,7 +130,7 @@ func (h *AnalyticsHandler) calculateReadingStats(history []database.GetUserReadi
|
||||
longestSession = int(minutes)
|
||||
}
|
||||
|
||||
dateKey := entry.CreatedAt.Time.Format("2006-01-02")
|
||||
dateKey := entry.CreatedAt.Time.Format("01-02-2006")
|
||||
if dailyMap[dateKey] == nil {
|
||||
dailyMap[dateKey] = &DailyReading{
|
||||
Date: dateKey,
|
||||
@@ -141,7 +141,7 @@ func (h *AnalyticsHandler) calculateReadingStats(history []database.GetUserReadi
|
||||
|
||||
if entry.PagesRead.Valid {
|
||||
totalPages += int(entry.PagesRead.Int32)
|
||||
dateKey := entry.CreatedAt.Time.Format("2006-01-02")
|
||||
dateKey := entry.CreatedAt.Time.Format("01-02-2006")
|
||||
if dailyMap[dateKey] != nil {
|
||||
dailyMap[dateKey].Pages += int(entry.PagesRead.Int32)
|
||||
}
|
||||
@@ -222,7 +222,7 @@ func (h *AnalyticsHandler) GetDeviceUsage(c *echo.Context) error {
|
||||
lastSync := ""
|
||||
if u.LastSync != nil {
|
||||
if t, ok := u.LastSync.(time.Time); ok {
|
||||
lastSync = t.Format("2006-01-02 15:04:05")
|
||||
lastSync = t.Format("01-02-2006 03:04:05 PM")
|
||||
}
|
||||
}
|
||||
|
||||
@@ -274,7 +274,7 @@ func (h *AnalyticsHandler) GetPopularBooks(c *echo.Context) error {
|
||||
lastRead := ""
|
||||
if book.LastRead != nil {
|
||||
if t, ok := book.LastRead.(time.Time); ok {
|
||||
lastRead = t.Format("2006-01-02 15:04:05")
|
||||
lastRead = t.Format("01-02-2006 03:04:05 PM")
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -306,7 +306,7 @@ func (h *Handler) GetAllProgress(c *echo.Context) error {
|
||||
|
||||
lastUpdated := ""
|
||||
if progress.LastReadAt.Valid {
|
||||
lastUpdated = progress.LastReadAt.Time.Format("2006-01-02 15:04")
|
||||
lastUpdated = progress.LastReadAt.Time.Format("01-02-2006 03:04 PM")
|
||||
}
|
||||
|
||||
progressList = append(progressList, ProgressWithMedia{
|
||||
|
||||
Reference in New Issue
Block a user