Skip to content

Commit 479511e

Browse files
Merge pull request #594 from adobe/clamoureux/secondGranularityColon
feat: added colon prefix to second granularity labels
2 parents 3c98a2b + 13d412b commit 479511e

File tree

2 files changed

+7
-7
lines changed

2 files changed

+7
-7
lines changed

packages/react-spectrum-charts/src/stories/components/Axis/Axis.test.tsx

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -77,8 +77,8 @@ describe('Axis', () => {
7777
const timeLabels = screen.getAllByText(/\d+:\d+ [AP]M/);
7878
expect(timeLabels.length).toBeGreaterThan(0);
7979

80-
// Check for second labels (secondary label)
81-
const secondLabels = screen.getAllByText(/^\d{1,2}$/); // Just digits for seconds
80+
// Check for second labels (secondary label) with colon prefix
81+
const secondLabels = screen.getAllByText(/^:\d{1,2}$/); // Colon followed by digits for seconds
8282
expect(secondLabels.length).toBeGreaterThan(0);
8383
});
8484

@@ -91,8 +91,8 @@ describe('Axis', () => {
9191
const timeLabels = screen.getAllByText(/\d+:\d+ [AP]M/);
9292
expect(timeLabels.length).toBeGreaterThan(0);
9393

94-
// Check for second labels (secondary label)
95-
const secondLabels = screen.getAllByText(/^\d{1,2}$/); // Just digits for seconds
94+
// Check for second labels (secondary label) with colon prefix
95+
const secondLabels = screen.getAllByText(/^:\d{1,2}$/); // Colon followed by digits for seconds
9696
expect(secondLabels.length).toBeGreaterThan(0);
9797
});
9898

@@ -174,8 +174,8 @@ describe('Axis', () => {
174174
const timeLabels = screen.getAllByText(/\d+:\d+ [AP]M/);
175175
expect(timeLabels.length).toBeGreaterThan(0);
176176

177-
// Check for second labels
178-
const secondLabels = screen.getAllByText(/^\d{1,2}$/);
177+
// Check for second labels with colon prefix
178+
const secondLabels = screen.getAllByText(/^:\d{1,2}$/);
179179
expect(secondLabels.length).toBeGreaterThan(0);
180180
});
181181

packages/vega-spec-builder/src/axis/axisLabelUtils.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ export const getTimeLabelFormats = (
4848
): { secondaryLabelFormat: string; primaryLabelFormat: string; tickCount: TickCount } => {
4949
switch (granularity) {
5050
case 'second':
51-
return { secondaryLabelFormat: '%S', primaryLabelFormat: '%-I:%M %p', tickCount: 'second' };
51+
return { secondaryLabelFormat: ':%S', primaryLabelFormat: '%-I:%M %p', tickCount: 'second' };
5252
case 'minute':
5353
return { secondaryLabelFormat: '%-I:%M %p', primaryLabelFormat: '%b %-d', tickCount: 'minute' };
5454
case 'hour':

0 commit comments

Comments
 (0)