Skip to content

Commit

Permalink
feat: 🎸 [DateTimePicker] added no ampm format
Browse files Browse the repository at this point in the history
✅ Closes: #336
  • Loading branch information
CrisGrud committed Oct 3, 2023
1 parent d1453ad commit 6e0d464
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 15 deletions.
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -110,9 +110,9 @@
"pre:push": "npm run build && npm run test:coverage --ci",
"pre:test": "cp -f ./.typescript/tsconfig.test.json ./tsconfig.json",
"prepare": "husky install",
"start": "npm run pre:test && storybook dev -p 6006",
"test": "npm run pre:test && jest --clearCache && jest --c ./.jest/config.ts --watch",
"test:coverage": "npm run pre:test && jest --clearCache && jest --c ./.jest/config.ts --coverage",
"start": "storybook dev -p 6006",
"test": "jest --clearCache && jest --c ./.jest/config.ts --watch",
"test:coverage": "jest --clearCache && jest --c ./.jest/config.ts --coverage",
"test:storybook": "test-storybook --coverage --coverageDirectory coverage/storybook --ci --verbose",
"upload": "npm run build && npm publish --access public",
"update:packages": "npx npm-check-updates --interactive --upgrade --doctor --doctorTest 'npm run pre:push'",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,20 +4,20 @@ import { ComponentMeta, ComponentStory } from "@storybook/react";
import { localeDecorator } from "../../utils/mocks/LocaleMock";
import getDocsPage from "../../utils/stories";

import TimePicker, { DATA_CY_DEFAULT } from ".";
import DateTimePicker, { DATA_CY_DEFAULT } from ".";

const COMPONENT_NAME = "Tabs";
TimePicker.displayName = COMPONENT_NAME;
const COMPONENT_NAME = "DateTimePicker";
DateTimePicker.displayName = COMPONENT_NAME;

export default {
title: "Navigation/TimePicker",
component: TimePicker,
title: "Inputs/DateTimePicker",
component: DateTimePicker,
decorators: [localeDecorator],
parameters: {
docs: {
...getDocsPage({
basedOn: {
label: "MUI TimePicker Component",
label: "MUI DateTimePicker Component",
url: "https://mui.com/material-ui/react-progress/",
},
component: COMPONENT_NAME,
Expand All @@ -27,9 +27,9 @@ export default {
}),
},
},
} as ComponentMeta<typeof TimePicker>;
} as ComponentMeta<typeof DateTimePicker>;

const Template: ComponentStory<typeof TimePicker> = (args) => <TimePicker {...args} dataCy={DATA_CY_DEFAULT} />;
const Template: ComponentStory<typeof DateTimePicker> = (args) => <DateTimePicker {...args} dataCy={DATA_CY_DEFAULT} />;

export const Primary = Template.bind({});
Primary.args = {};
Original file line number Diff line number Diff line change
@@ -1,20 +1,22 @@
import React, { FC } from "react";
import { AdapterLuxon } from "@mui/x-date-pickers/AdapterLuxon";
import { DateTimePicker } from "@mui/x-date-pickers/DateTimePicker";
import { DateTimePicker as MuiDateTimePicker } from "@mui/x-date-pickers/DateTimePicker";
import { LocalizationProvider } from "@mui/x-date-pickers/LocalizationProvider";

export const DATA_CY_DEFAULT = "timePicker";

const TimePicker: FC<any> = ({ dataCy = DATA_CY_DEFAULT }) => {
const DateTimePicker: FC<any> = ({ dataCy = DATA_CY_DEFAULT }) => {
return (
<LocalizationProvider dateAdapter={AdapterLuxon}>
<DateTimePicker
<MuiDateTimePicker
data-cy={dataCy}
label="Date Time"
views={["year", "month", "day", "hours", "minutes", "seconds"]}
format="dd/MM/yyyy HH:mm:ss"
ampm={false}
/>
</LocalizationProvider>
);
};

export default TimePicker;
export default DateTimePicker;

0 comments on commit 6e0d464

Please sign in to comment.