File tree Expand file tree Collapse file tree 1 file changed +7
-11
lines changed
lib/components/narrative/line-itin Expand file tree Collapse file tree 1 file changed +7
-11
lines changed Original file line number Diff line number Diff line change @@ -203,18 +203,14 @@ class AlertsBody extends Component {
203203 . sort ( ( a , b ) => b . effectiveStartDate - a . effectiveStartDate )
204204 . map ( ( alert , i ) => {
205205 const effectiveStartDate = moment ( alert . effectiveStartDate )
206- let effectiveDateString = 'Effective as of '
207206 const daysAway = moment ( ) . diff ( effectiveStartDate , 'days' )
208- // Add time if alert is effective within one day.
209- if ( Math . abs ( daysAway ) <= 1 ) {
210- effectiveDateString += `${ effectiveStartDate . format ( timeFormat ) } , `
211- }
212- effectiveDateString += effectiveStartDate
213- . calendar (
214- null ,
215- { sameElse : longDateFormat }
216- )
217- . split ( ' at' ) [ 0 ]
207+ // Add time if alert is effective within one day. Otherwise, use
208+ // calendar long date format (e.g., July 31, 2019).
209+ const dateTimeFormatter = Math . abs ( daysAway ) <= 1
210+ ? `${ timeFormat } , ${ longDateFormat } `
211+ : longDateFormat
212+ const dateTimeString = effectiveStartDate . format ( dateTimeFormatter )
213+ const effectiveDateString = `Effective as of ${ dateTimeString } `
218214 return (
219215 < div key = { i } className = 'transit-alert' >
220216 < div className = 'alert-icon' > < i className = 'fa fa-exclamation-triangle' /> </ div >
You can’t perform that action at this time.
0 commit comments