Skip to content

ref(tsc): usageChart utils to tsx #52935

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

Merged
merged 1 commit into from
Jul 17, 2023
Merged
Show file tree
Hide file tree
Changes from all 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
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ describe('getDateFromMoment', () => {
// Ensure date remains in UTC
it('shows the date if interval is >= 24h', () => {
expect(getDateFromMoment(start)).toBe('Jul 9');
expect(getDateFromMoment(start, '7d')).toBe('Jul 9');
expect(getDateFromMoment(start, '2d')).toBe('Jul 9');
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
expect(getDateFromMoment(start, '2d')).toBe('Jul 9');
expect(getDateFromMoment(start, '7d')).toBe('Jul 9');

this should be kept the same, right?

Copy link
Member Author

@IanWoodard IanWoodard Jul 17, 2023

Choose a reason for hiding this comment

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

I changed it since 7d is not a valid IntervalPeriod.

Copy link
Contributor

Choose a reason for hiding this comment

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

do you mean 2d is not valid? It's 7d after your change

Copy link
Member Author

Choose a reason for hiding this comment

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

That is Cathy's suggested change. I changed it from 7d to 2d.

Copy link
Contributor

Choose a reason for hiding this comment

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

mb 👍

Copy link
Member

Choose a reason for hiding this comment

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

oh i see there's an IntervalPeriod object

expect(getDateFromMoment(moment('2021-10-31'))).toBe('Oct 31');
});

Expand Down
4 changes: 2 additions & 2 deletions static/app/views/organizationStats/usageChart/utils.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,8 @@ export function getDateFromUnixTimestamp(timestamp: number) {
}

export function getXAxisDates(
dateStart: string,
dateEnd: string,
dateStart: moment.MomentInput,
dateEnd: moment.MomentInput,
dateUtc: boolean = false,
interval: IntervalPeriod = '1d'
): string[] {
Expand Down