IO-2834 Split Date and DateTime formats, remove shorthand and checks
Signed-off-by: Allan Carr <allan.carr@thinkimex.com>
This commit is contained in:
@@ -1,8 +1,8 @@
|
||||
import React, { useCallback, useState } from "react";
|
||||
import { DatePicker } from "antd";
|
||||
import dayjs from "../../utils/day";
|
||||
import { formats, shorthandFormats } from "./formats.js";
|
||||
import PropTypes from "prop-types";
|
||||
import React, { useCallback, useState } from "react";
|
||||
import dayjs from "../../utils/day";
|
||||
import { formats } from "./formats.js";
|
||||
|
||||
const DateTimePicker = ({ value, onChange, onBlur, id, onlyFuture, onlyToday, isDateOnly = false, ...restProps }) => {
|
||||
const [isManualInput, setIsManualInput] = useState(false);
|
||||
@@ -34,18 +34,14 @@ const DateTimePicker = ({ value, onChange, onBlur, id, onlyFuture, onlyToday, is
|
||||
|
||||
let _a;
|
||||
|
||||
for (const format of shorthandFormats) {
|
||||
for (const format of formats) {
|
||||
console.log("format",format);
|
||||
_a = dayjs(upperV, format);
|
||||
console.log("🚀 ~ DateTimePicker ~ _a:", _a)
|
||||
console.log("isvalid",_a.isValid());
|
||||
if (_a.isValid()) break;
|
||||
}
|
||||
|
||||
if (!_a || !_a.isValid()) {
|
||||
for (const format of formats) {
|
||||
_a = dayjs(upperV, format);
|
||||
if (_a.isValid()) break;
|
||||
}
|
||||
}
|
||||
|
||||
if (_a && _a.isValid()) {
|
||||
if (isDateOnly) {
|
||||
_a = _a.startOf("day");
|
||||
|
||||
Reference in New Issue
Block a user