@@ -5,16 +5,17 @@ import React, { useRef } from "react";
|
|||||||
import {connect} from "react-redux";
|
import {connect} from "react-redux";
|
||||||
import {createStructuredSelector} from "reselect";
|
import {createStructuredSelector} from "reselect";
|
||||||
import {selectBodyshop} from "../../redux/user/user.selectors";
|
import {selectBodyshop} from "../../redux/user/user.selectors";
|
||||||
|
|
||||||
const mapStateToProps = createStructuredSelector({
|
const mapStateToProps = createStructuredSelector({
|
||||||
bodyshop: selectBodyshop,
|
bodyshop: selectBodyshop,
|
||||||
});
|
});
|
||||||
const mapDispatchToProps = (dispatch) => ({});
|
const mapDispatchToProps = (dispatch) => ({
|
||||||
|
//setUserLanguage: language => dispatch(setUserLanguage(language))
|
||||||
|
});
|
||||||
export default connect(mapStateToProps, mapDispatchToProps)(FormDatePicker);
|
export default connect(mapStateToProps, mapDispatchToProps)(FormDatePicker);
|
||||||
|
|
||||||
const dateFormat = "MM/DD/YYYY";
|
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({
|
export function FormDatePicker({
|
||||||
bodyshop,
|
bodyshop,
|
||||||
value,
|
value,
|
||||||
@@ -46,12 +47,16 @@ export function FormDatePicker({
|
|||||||
const v = e.target.value;
|
const v = e.target.value;
|
||||||
if (!v) return;
|
if (!v) return;
|
||||||
|
|
||||||
const _a = dayjs(
|
const formats = ["MMDDYY", "MMDDYYYY", "MMDD", "MM/DD/YY", "MM/DD/YYYY"];
|
||||||
v,
|
let _a;
|
||||||
["MMDDYY", "MMDDYYYY", "MMDD", "MM/DD/YY"],
|
|
||||||
"en",
|
// Iterate through formats to find the correct one
|
||||||
false
|
for (let format of formats) {
|
||||||
);
|
_a = dayjs(v, format);
|
||||||
|
if (v === _a.format(format)) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (
|
if (
|
||||||
_a.isValid()
|
_a.isValid()
|
||||||
|
|||||||
Reference in New Issue
Block a user