Skip to content
Open
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 @@ -9,7 +9,7 @@ const DatePicker = lazy(() => import(/* webpackChunkName: "tutor-react-datepicke
const CalendarContainer = lazy(() => import('react-datepicker').then((module) => ({ default: module.CalendarContainer })));

const TutorDateRangePicker = () => {
const dateFormat = 'Y-M-d';
const dateFormat = 'yyyy-MM-dd';

const [dropdownMonth, setDropdownMonth] = useState(false);
const [dropdownYear, setDropdownYear] = useState(false);
Expand Down
4 changes: 2 additions & 2 deletions v2-library/src/components/datapicker/TutorDateTimePicker.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ const TutorDateTimePicker = (data) => {
<DatePicker
inline={data.inline ? true : false}
customInput={<CustomInput />}
placeholderText="Y-M-d h:mm aa"
placeholderText="yyyy-MM-dd h:mm aa"
selected={startDate}
onChange={(date) => handleCalendarChange(date)}
showPopperArrow={false}
Expand All @@ -38,7 +38,7 @@ const TutorDateTimePicker = (data) => {
onCalendarClose={handleCalendarClose}
onClick={handleCalendarClose}
timeCaption={__('Time', 'tutor')}
dateFormat="Y-M-d h:mm aa"
dateFormat="yyyy-MM-dd h:mm aa"
minDate={data.disable_previous ? new Date() : false}
formatWeekDay={(nameOfDay) => translateWeekday(nameOfDay)}
calendarStartDay={_tutorobject.start_of_week}
Expand Down
4 changes: 2 additions & 2 deletions v2-library/src/components/datapicker/TutorDatepicker.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ const TutorDatepicker = (data) => {
if (data.disable_past_date) {
isPreviousDateAllowed = false;
}
const dateFormat = 'Y-M-d';
const dateFormat = 'yyyy-MM-dd';
const default_date = data.input_value || null;
const url = new URL(window.location.href);
const params = url.searchParams;
Expand All @@ -47,7 +47,7 @@ const TutorDatepicker = (data) => {

useEffect(() => {
if (params.has('date') && !!params.get('date')) {
setStartDate(new Date(params.get('date')));
setStartDate(stringToDate(params.get('date'), 'yyyy-mm-dd', '-'));
}
}, []);

Expand Down
2 changes: 1 addition & 1 deletion v2-library/src/components/datapicker/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ export const weeks = [
export function stringToDate(_date, _format, _delimiter) {
const formatLowerCase = _format.toLowerCase();
const formatItems = formatLowerCase.split(_delimiter);
const dateItems = _date.split(_delimiter);
const dateItems = String(_date).split(_delimiter);
const monthIndex = formatItems.indexOf('mm');
const dayIndex = formatItems.indexOf('dd');
const yearIndex = formatItems.indexOf('yyyy');
Expand Down
Loading