Skip to content

Commit

Permalink
formatted the code using npm run format
Browse files Browse the repository at this point in the history
  • Loading branch information
harshitg927 committed Jan 19, 2025
1 parent fa1014e commit ce69dd7
Showing 1 changed file with 13 additions and 12 deletions.
25 changes: 13 additions & 12 deletions frontend/src/components/common/CustomDatePicker.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,20 +23,21 @@ const CustomDatePicker = (props) => {
function handleInputChange(e) {
const inputValue = event.target.value;

const isFrenchLocale = configurationProperties.DEFAULT_DATE_LOCALE === "fr-FR";
const partialDateRegex = isFrenchLocale
? /^(\d{0,2})(\/(\d{0,2})(\/(\d{0,4})?)?)?$/
: /^(\d{0,2})(\/(\d{0,2})(\/(\d{0,4})?)?)?$/;
const isFrenchLocale =
configurationProperties.DEFAULT_DATE_LOCALE === "fr-FR";
const partialDateRegex = isFrenchLocale
? /^(\d{0,2})(\/(\d{0,2})(\/(\d{0,4})?)?)?$/
: /^(\d{0,2})(\/(\d{0,2})(\/(\d{0,4})?)?)?$/;

const fullDateRegex = isFrenchLocale
? /^(0[1-9]|[12][0-9]|3[01])\/(0[1-9]|1[0-2])\/\d{4}$/
: /^(0[1-9]|1[0-2])\/(0[1-9]|[12][0-9]|3[01])\/\d{4}$/;
const fullDateRegex = isFrenchLocale
? /^(0[1-9]|[12][0-9]|3[01])\/(0[1-9]|1[0-2])\/\d{4}$/
: /^(0[1-9]|1[0-2])\/(0[1-9]|[12][0-9]|3[01])\/\d{4}$/;

if (partialDateRegex.test(inputValue)) {
event.target.value = inputValue;
} else {
event.target.value = ""; // Clear invalid input
}
if (partialDateRegex.test(inputValue)) {
event.target.value = inputValue;
} else {
event.target.value = ""; // Clear invalid input
}
}

useEffect(() => {
Expand Down

0 comments on commit ce69dd7

Please sign in to comment.