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

Remove date-fns dependency drom table date picker #9585

Merged
merged 1 commit into from
May 8, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React from 'react';
import SolidIcon from '@/_ui/Icon/SolidIcons';
import { getMonth, getYear } from 'date-fns';
import moment from 'moment';
import { range } from 'lodash';

const CustomDatePickerHeader = ({
Expand All @@ -27,7 +27,7 @@ const CustomDatePickerHeader = ({
'December',
];

const years = range(1990, getYear(new Date()) + 1, 1);
const years = range(1990, moment(new Date()).year() + 1, 1);

return (
<>
Expand All @@ -51,7 +51,7 @@ const CustomDatePickerHeader = ({
</button>
<div style={{ marginRight: '8px' }}>
<select
value={months[getMonth(date)]}
value={months[moment(date).month()]}
onChange={({ target: { value } }) => changeMonth(months.indexOf(value))}
className="tj-datepicker-widget-month-selector"
>
Expand All @@ -62,7 +62,7 @@ const CustomDatePickerHeader = ({
))}
</select>
<select
value={getYear(date)}
value={moment(date).year()}
onChange={({ target: { value } }) => changeYear(value)}
className="tj-datepicker-widget-year-selector"
style={{ padding: '4px 6px' }}
Expand Down