@@ -9,6 +9,10 @@ import {
99 formatISODate ,
1010 formatSecondsAsDuration ,
1111 parseDateIsoStringOrNull ,
12+ setDateFmt ,
13+ getDateFmt ,
14+ DATE_FMT_12HR ,
15+ DATE_FMT_24HR ,
1216} from " ../../utils/formatting" ;
1317import {useExpandedStore } from " ../../utils/expansion" ;
1418import {
@@ -20,13 +24,15 @@ import {
2024} from " ./data" ;
2125import Collector from " ./collector.vue" ;
2226import CommitSha from " ./commit-sha.vue" ;
27+ import DateFmtPicker from " ./date-format-selection.vue" ;
2328
2429const loading = ref (true );
2530
2631const data: Ref <{
2732 timeline: BenchmarkRequestRow [];
2833 queueLength: number ;
2934 collectors: CollectorConfig [];
35+ dateFmt: string ;
3036} | null > = ref (null );
3137
3238type BenchmarkRequestRow = BenchmarkRequest & {
@@ -77,6 +83,7 @@ async function loadStatusData(loading: Ref<boolean>) {
7783 timeline ,
7884 collectors: resp .collectors ,
7985 queueLength ,
86+ dateFmt: getDateFmt (),
8087 };
8188 });
8289}
@@ -101,6 +108,11 @@ function formatStatus(request: BenchmarkRequest): string {
101108 }
102109}
103110
111+ function formatDate(dateString ? : string ): string {
112+ const fmt = data .value .dateFmt ;
113+ return formatISODate (dateString , fmt );
114+ }
115+
104116function hasErrors(request : BenchmarkRequest ) {
105117 return Object .keys (request .errors ).length !== 0 ;
106118}
@@ -204,6 +216,17 @@ const {toggleExpanded: toggleExpandedErrors, isExpanded: hasExpandedErrors} =
204216
205217const tableWidth = 8 ;
206218
219+ function toggleDate() {
220+ let dateFmt: string ;
221+ if (data .value .dateFmt === DATE_FMT_24HR ) {
222+ dateFmt = DATE_FMT_12HR ;
223+ } else {
224+ dateFmt = DATE_FMT_24HR ;
225+ }
226+ setDateFmt (dateFmt );
227+ data .value .dateFmt = dateFmt ;
228+ }
229+
207230loadStatusData (loading );
208231 </script >
209232
@@ -212,8 +235,9 @@ loadStatusData(loading);
212235 <div class =" status-page-wrapper" >
213236 <div class =" timeline-wrapper" >
214237 <h1 >Timeline</h1 >
215- <span class =" small-padding-bottom" >
238+ <span class =" local-time-message small-padding-bottom" >
216239 <strong >Times are local.</strong >
240+ <DateFmtPicker :toggleDate =" toggleDate" :dateFmt =" data.dateFmt" />
217241 </span >
218242 <span class =" small-padding-bottom" >
219243 <ExpectedCurrentRequestCompletion />
@@ -256,7 +280,7 @@ loadStatusData(loading);
256280 />
257281 </td >
258282 <td >
259- {{ formatISODate (req.completedAt) }}
283+ {{ formatDate (req.completedAt) }}
260284 <span v-if =" req.endEstimated" >(est.)</span >
261285 </td >
262286 <td style =" text-align : right " >
@@ -421,4 +445,11 @@ loadStatusData(loading);
421445.small-padding-bottom {
422446 padding-bottom : 8px ;
423447}
448+
449+ .local-time-message {
450+ display : flex ;
451+ flex-direction : column ;
452+ align-items : center ;
453+ padding-bottom : 12px ;
454+ }
424455 </style >
0 commit comments