Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix date formatting #56124

Merged
merged 5 commits into from
Feb 6, 2025
Merged
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/libs/DateUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -819,9 +819,9 @@ function getFormattedReservationRangeDate(date1: Date, date2: Date): string {
*/
function getFormattedTransportDate(date: Date): string {
if (isThisYear(date)) {
return `${translateLocal('travel.departs')} ${format(date, 'EEEE, MMM d')} ${translateLocal('common.conjunctionAt')} ${format(date, 'HH:MM')}`;
return `${translateLocal('travel.departs')} ${format(date, 'EEEE, MMM d')} ${translateLocal('common.conjunctionAt')} ${format(date, 'HH:mm a')}`;
}
return `${translateLocal('travel.departs')} ${format(date, 'EEEE, MMM d, yyyy')} ${translateLocal('common.conjunctionAt')} ${format(date, 'HH:MM')}`;
return `${translateLocal('travel.departs')} ${format(date, 'EEEE, MMM d, yyyy')} ${translateLocal('common.conjunctionAt')} ${format(date, 'HH:mm a')}`;
Copy link
Contributor

@dominictb dominictb Feb 6, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@aldo-expensify @stitesExpensify Hmm as we are adding AM/PM postfix here (a flag), I wonder if it's redundant to use 24-hour format (HH flag). So it could be something like 16:40 PM which is not standard to me.

Should it be 12-hour format only (hh)? That would align more to the current convention in App codebase (i.e. if we had a flag, we always used 12-hour format):

return format(date, isFullFormat ? 'hh:mm:ss.SSS a' : 'hh:mm a');

return format(date, 'yyyy-MM-dd hh:mm a');

const tempTime = parse(updatedTime, 'hh:mm a', new Date());

const parsedTime = parse(dateTime, isFullFormat ? 'hh:mm:ss.SSS a' : 'hh:mm a', new Date());

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agreee

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes I agree. I will fix that!

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated!

}

/**
Expand Down