Fix IO-2533

Signed-off-by: Dave Richer <dave@imexsystems.ca>
This commit is contained in:
Dave Richer
2024-01-08 14:11:49 -05:00
parent 6e377f98a7
commit 213a02d5f2

View File

@@ -5,16 +5,17 @@ import React, { useRef } from "react";
import {connect} from "react-redux";
import {createStructuredSelector} from "reselect";
import {selectBodyshop} from "../../redux/user/user.selectors";
const mapStateToProps = createStructuredSelector({
bodyshop: selectBodyshop,
});
const mapDispatchToProps = (dispatch) => ({});
const mapDispatchToProps = (dispatch) => ({
//setUserLanguage: language => dispatch(setUserLanguage(language))
});
export default connect(mapStateToProps, mapDispatchToProps)(FormDatePicker);
const dateFormat = "MM/DD/YYYY";
// TODO, this is causing a dirty change when it should not (click the picker, click off the picker)
export function FormDatePicker({
bodyshop,
value,
@@ -46,12 +47,16 @@ export function FormDatePicker({
const v = e.target.value;
if (!v) return;
const _a = dayjs(
v,
["MMDDYY", "MMDDYYYY", "MMDD", "MM/DD/YY"],
"en",
false
);
const formats = ["MMDDYY", "MMDDYYYY", "MMDD", "MM/DD/YY", "MM/DD/YYYY"];
let _a;
// Iterate through formats to find the correct one
for (let format of formats) {
_a = dayjs(v, format);
if (v === _a.format(format)) {
break;
}
}
if (
_a.isValid()