use the correct method when converting time strings in react w/ burnettk
This commit is contained in:
parent
359aef9efe
commit
1dfa64ca76
|
@ -50052,7 +50052,7 @@
|
||||||
"@csstools/postcss-text-decoration-shorthand": "^1.0.0",
|
"@csstools/postcss-text-decoration-shorthand": "^1.0.0",
|
||||||
"@csstools/postcss-trigonometric-functions": "^1.0.2",
|
"@csstools/postcss-trigonometric-functions": "^1.0.2",
|
||||||
"@csstools/postcss-unset-value": "^1.0.2",
|
"@csstools/postcss-unset-value": "^1.0.2",
|
||||||
"autoprefixer": "^10.4.13",
|
"autoprefixer": "10.4.5",
|
||||||
"browserslist": "^4.21.4",
|
"browserslist": "^4.21.4",
|
||||||
"css-blank-pseudo": "^3.0.3",
|
"css-blank-pseudo": "^3.0.3",
|
||||||
"css-has-pseudo": "^3.0.4",
|
"css-has-pseudo": "^3.0.4",
|
||||||
|
@ -50090,7 +50090,8 @@
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"autoprefixer": {
|
"autoprefixer": {
|
||||||
"version": "https://registry.npmjs.org/autoprefixer/-/autoprefixer-10.4.5.tgz",
|
"version": "10.4.5",
|
||||||
|
"resolved": "https://registry.npmjs.org/autoprefixer/-/autoprefixer-10.4.5.tgz",
|
||||||
"integrity": "sha512-Fvd8yCoA7lNX/OUllvS+aS1I7WRBclGXsepbvT8ZaPgrH24rgXpZzF0/6Hh3ZEkwg+0AES/Osd196VZmYoEFtw==",
|
"integrity": "sha512-Fvd8yCoA7lNX/OUllvS+aS1I7WRBclGXsepbvT8ZaPgrH24rgXpZzF0/6Hh3ZEkwg+0AES/Osd196VZmYoEFtw==",
|
||||||
"requires": {
|
"requires": {
|
||||||
"browserslist": "^4.20.2",
|
"browserslist": "^4.20.2",
|
||||||
|
|
|
@ -71,9 +71,6 @@ export const convertDateObjectToFormattedString = (dateObject: Date) => {
|
||||||
};
|
};
|
||||||
|
|
||||||
export const dateStringToYMDFormat = (dateString: string) => {
|
export const dateStringToYMDFormat = (dateString: string) => {
|
||||||
if (dateString.length < 10) {
|
|
||||||
return dateString;
|
|
||||||
}
|
|
||||||
if (DATE_FORMAT.startsWith('dd')) {
|
if (DATE_FORMAT.startsWith('dd')) {
|
||||||
const d = dateString.split('-');
|
const d = dateString.split('-');
|
||||||
return `${d[2]}-${d[1]}-${d[0]}`;
|
return `${d[2]}-${d[1]}-${d[0]}`;
|
||||||
|
@ -107,12 +104,15 @@ export const convertDateAndTimeStringsToSeconds = (
|
||||||
};
|
};
|
||||||
|
|
||||||
export const convertStringToDate = (dateString: string) => {
|
export const convertStringToDate = (dateString: string) => {
|
||||||
return convertDateAndTimeStringsToSeconds(dateString, '00:10:00');
|
return convertDateAndTimeStringsToDate(dateString, '00:10:00');
|
||||||
};
|
};
|
||||||
|
|
||||||
export const ymdDateStringToConfiguredFormat = (dateString: string) => {
|
export const ymdDateStringToConfiguredFormat = (dateString: string) => {
|
||||||
const dateObject = convertStringToDate(dateString);
|
const dateObject = convertStringToDate(dateString);
|
||||||
return convertDateObjectToFormattedString(dateObject);
|
if (dateObject) {
|
||||||
|
return convertDateObjectToFormattedString(dateObject);
|
||||||
|
}
|
||||||
|
return null;
|
||||||
};
|
};
|
||||||
|
|
||||||
export const convertSecondsToDateObject = (seconds: number) => {
|
export const convertSecondsToDateObject = (seconds: number) => {
|
||||||
|
@ -155,7 +155,10 @@ export const convertSecondsToFormattedDateString = (seconds: number) => {
|
||||||
|
|
||||||
export const convertDateStringToSeconds = (dateString: string) => {
|
export const convertDateStringToSeconds = (dateString: string) => {
|
||||||
const dateObject = convertStringToDate(dateString);
|
const dateObject = convertStringToDate(dateString);
|
||||||
return convertDateToSeconds(dateObject);
|
if (dateObject) {
|
||||||
|
return convertDateToSeconds(dateObject);
|
||||||
|
}
|
||||||
|
return null;
|
||||||
};
|
};
|
||||||
|
|
||||||
export const objectIsEmpty = (obj: object) => {
|
export const objectIsEmpty = (obj: object) => {
|
||||||
|
|
|
@ -102,7 +102,11 @@ export default function BaseInputTemplate<
|
||||||
// it should in be y-m-d when it gets here.
|
// it should in be y-m-d when it gets here.
|
||||||
let dateValue: string | null = '';
|
let dateValue: string | null = '';
|
||||||
if (value || value === 0) {
|
if (value || value === 0) {
|
||||||
dateValue = ymdDateStringToConfiguredFormat(value);
|
if (value.length < 10) {
|
||||||
|
dateValue = value;
|
||||||
|
} else {
|
||||||
|
dateValue = ymdDateStringToConfiguredFormat(value);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
component = (
|
component = (
|
||||||
|
|
Loading…
Reference in New Issue