web: format time string

This commit is contained in:
Chris Sexton 2024-02-28 17:05:23 -05:00
parent 25f9171223
commit 95ae28aa0f
3 changed files with 5 additions and 5 deletions

View File

@ -14,6 +14,6 @@ func New() *Stats {
return &Stats{startTime: time.Now()} return &Stats{startTime: time.Now()}
} }
func (s Stats) Uptime() time.Duration { func (s Stats) Uptime() string {
return time.Now().Sub(s.startTime) return time.Now().Sub(s.startTime).Truncate(time.Second).String()
} }

View File

@ -76,7 +76,7 @@ templ (w *Web) showStats() {
</tr> </tr>
<tr> <tr>
<td>Uptime</td> <td>Uptime</td>
<td>{ fmt.Sprintf("%v", w.stats.Uptime()) }</td> <td>{ w.stats.Uptime() }</td>
</tr> </tr>
</table> </table>
</div> </div>

View File

@ -314,9 +314,9 @@ func (w *Web) showStats() templ.Component {
return templ_7745c5c3_Err return templ_7745c5c3_Err
} }
var templ_7745c5c3_Var16 string var templ_7745c5c3_Var16 string
templ_7745c5c3_Var16, templ_7745c5c3_Err = templ.JoinStringErrs(fmt.Sprintf("%v", w.stats.Uptime())) templ_7745c5c3_Var16, templ_7745c5c3_Err = templ.JoinStringErrs(w.stats.Uptime())
if templ_7745c5c3_Err != nil { if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `bot/web/index.templ`, Line: 78, Col: 53} return templ.Error{Err: templ_7745c5c3_Err, FileName: `bot/web/index.templ`, Line: 78, Col: 34}
} }
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var16)) _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var16))
if templ_7745c5c3_Err != nil { if templ_7745c5c3_Err != nil {