Skip to content

Commit 98e2765

Browse files
feed detail: timezone + dataset sdr (#1044)
1 parent c29a3f0 commit 98e2765

File tree

5 files changed

+175
-76
lines changed

5 files changed

+175
-76
lines changed

web-app/public/locales/en/common.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
"serviceAlerts": "Service Alerts"
1717
},
1818
"loading": "Loading...",
19+
"download": "Download",
1920
"errors": {
2021
"generic": "We are unable to complete your request at the moment."
2122
},

web-app/public/locales/en/feeds.json

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@
101101
"qualityReportUpdated": "Quality report updated",
102102
"officialFeedUpdated": "Official verification updated",
103103
"serviceDateRange": "Service Date Range",
104-
"serviceDateRangeTooltip": "Dates are relative to local timezone",
104+
"serviceDateRangeTooltip": "Dates are relative to the specified timezone. If no timezone is specified, the dates are in UTC.",
105105
"heatmapIntensity": "Stop Density",
106106
"heatmapExplanationTitle": "What does this mean?",
107107
"heatmapExplanationContent": "This color scale shows the percentage of stops from <code>stops.txt</code> that are located within each geographic area. Darker colors indicate areas where a higher percentage of stops are covered.",
@@ -128,5 +128,16 @@
128128
"toolTip": "Future Feed",
129129
"toolTipLong": "This feed is not yet active but will be used in the future."
130130
}
131+
},
132+
"datasetHistory": "Dataset History",
133+
"datasetHistoryDescription": "The Mobility Database fetches and stores new datasets twice a week, on Mondays and Thursdays at midnight EST.",
134+
"datasets": "Datasets",
135+
"validationReportNotAvailable": "Validation report not available",
136+
"runValidationReportYourself": "Run Validator Yourself",
137+
"datasetHistoryTooltip": {
138+
"serviceDateRange": "Service date range of when this dataset is active",
139+
"downloadReport": "Download the dataset for this feed",
140+
"viewReport": "View Validation Report",
141+
"viewJsonReport": "View Validation Report in JSON format"
131142
}
132143
}

web-app/src/app/screens/Feed/Feed.functions.tsx

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import { Box, Typography } from '@mui/material';
12
import { type TFunction } from 'i18next';
23

34
export function formatProvidersSorted(provider: string): string[] {
@@ -62,3 +63,37 @@ export function generatePageTitle(
6263
newDocTitle += 'Mobility Database';
6364
return newDocTitle;
6465
}
66+
67+
export const formatServiceDateRange = (
68+
dateStart: string,
69+
dateEnd: string,
70+
timeZone?: string,
71+
): JSX.Element => {
72+
const startDate = new Date(dateStart);
73+
const endDate = new Date(dateEnd);
74+
const usedTimezone = timeZone ?? 'UTC';
75+
// Note: If the timezone isn't set, it will default to UTC
76+
// If the timezone is set, but has an invalid value, it will default to the user's local timezone
77+
const formattedDateStart = new Intl.DateTimeFormat('en-US', {
78+
timeZone: usedTimezone,
79+
month: 'short',
80+
day: 'numeric',
81+
year: 'numeric',
82+
}).format(startDate);
83+
const formattedDateEnd = new Intl.DateTimeFormat('en-US', {
84+
month: 'short',
85+
day: 'numeric',
86+
year: 'numeric',
87+
}).format(endDate);
88+
return (
89+
<Box>
90+
<Typography variant='body1'>
91+
{formattedDateStart}{' '}
92+
<Typography component={'span'} sx={{ mx: 1, fontSize: '14px' }}>
93+
-
94+
</Typography>{' '}
95+
{formattedDateEnd}
96+
</Typography>
97+
</Box>
98+
);
99+
};

web-app/src/app/screens/Feed/FeedSummary.tsx

Lines changed: 16 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,10 @@ import EmailIcon from '@mui/icons-material/Email';
3131
import LockIcon from '@mui/icons-material/Lock';
3232
import DateRangeIcon from '@mui/icons-material/DateRange';
3333
import InfoOutlinedIcon from '@mui/icons-material/InfoOutlined';
34+
import AccessTimeIcon from '@mui/icons-material/AccessTime';
3435
import { FeedStatusIndicator } from '../../components/FeedStatus';
3536
import Locations from '../../components/Locations';
37+
import { formatServiceDateRange } from './Feed.functions';
3638

3739
export interface FeedSummaryProps {
3840
feed: GTFSFeedType | GTFSRTFeedType | undefined;
@@ -76,35 +78,6 @@ const ResponsiveListItem = styled('li')(({ theme }) => ({
7678
},
7779
}));
7880

79-
const formatServiceDateRange = (
80-
dateStart: string,
81-
dateEnd: string,
82-
): JSX.Element => {
83-
const startDate = new Date(dateStart);
84-
const endDate = new Date(dateEnd);
85-
const formattedDateStart = new Intl.DateTimeFormat('en-US', {
86-
month: 'short',
87-
day: 'numeric',
88-
year: 'numeric',
89-
}).format(startDate);
90-
const formattedDateEnd = new Intl.DateTimeFormat('en-US', {
91-
month: 'short',
92-
day: 'numeric',
93-
year: 'numeric',
94-
}).format(endDate);
95-
return (
96-
<Box>
97-
<Typography variant='body1'>
98-
{formattedDateStart}{' '}
99-
<Typography component={'span'} sx={{ mx: 2, fontSize: '14px' }}>
100-
-
101-
</Typography>{' '}
102-
{formattedDateEnd}
103-
</Typography>
104-
</Box>
105-
);
106-
};
107-
10881
export default function FeedSummary({
10982
feed,
11083
sortedProviders,
@@ -190,6 +163,19 @@ export default function FeedSummary({
190163
)}
191164
</Box>
192165
</Box>
166+
{latestDataset?.agency_timezone != undefined && (
167+
<Box sx={boxElementStyle}>
168+
<StyledTitleContainer>
169+
<AccessTimeIcon></AccessTimeIcon>
170+
<Typography variant='subtitle1' sx={{ fontWeight: 'bold' }}>
171+
Agency Timezone
172+
</Typography>
173+
</StyledTitleContainer>
174+
<Typography variant='body1'>
175+
{latestDataset.agency_timezone}
176+
</Typography>
177+
</Box>
178+
)}
193179
{latestDataset?.service_date_range_start != undefined &&
194180
latestDataset.service_date_range_end != undefined && (
195181
<Box sx={boxElementStyle}>
@@ -208,6 +194,7 @@ export default function FeedSummary({
208194
{formatServiceDateRange(
209195
latestDataset?.service_date_range_start,
210196
latestDataset?.service_date_range_end,
197+
latestDataset.agency_timezone,
211198
)}
212199
<FeedStatusIndicator
213200
status={feed?.status ?? ''}

0 commit comments

Comments
 (0)