Skip to content

Commit

Permalink
Merge pull request #4247 from parca-dev/unify-date-time-format
Browse files Browse the repository at this point in the history
ui: Unify date time format in Metrics graph
yomete authored Jan 3, 2024
2 parents 609093d + a69614d commit 0064835
Showing 2 changed files with 5 additions and 6 deletions.
3 changes: 1 addition & 2 deletions ui/packages/shared/profile/src/ProfileSource.tsx
Original file line number Diff line number Diff line change
@@ -38,8 +38,7 @@ export interface ProfileSelection {
Type: () => string;
}

export const timeFormat = "MMM d, 'at' h:mm:s a '(UTC)'";
export const timeFormatShort = 'MMM d, h:mma';
export const timeFormat = "MMM d, 'at' HH:mm:ss '(UTC)'";

export function ParamsString(params: {[key: string]: string}): string {
return Object.keys(params)
8 changes: 4 additions & 4 deletions ui/packages/shared/utilities/src/time.ts
Original file line number Diff line number Diff line change
@@ -139,15 +139,15 @@ export const formatForTimespan = (from: number, to: number): string => {
const durationInSeconds = getTotalSeconds(duration);

if (durationInSeconds <= getTotalSeconds({minutes: 4})) {
return 'H:mm:ss';
return 'HH:mm:ss';
}
if (durationInSeconds <= getTotalSeconds({hours: 13})) {
return 'H:mm';
return 'HH:mm';
}
if (durationInSeconds <= getTotalSeconds({hours: 25})) {
return 'H:mm d/M';
return 'HH:mm M/d';
}
return 'd/M';
return 'M/d';
};

export const getStepDuration = (start: number, end: number, stepCount = 1000): Duration => {

0 comments on commit 0064835

Please sign in to comment.