Skip to content

Commit

Permalink
Remove date-fns dependency drom table date picker (#9585)
Browse files Browse the repository at this point in the history
  • Loading branch information
nakulnagargade committed May 8, 2024
1 parent 6cd2f8f commit 9a4a819
Showing 1 changed file with 4 additions and 4 deletions.
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

0 comments on commit 9a4a819

Please sign in to comment.