Skip to content

Commit

Permalink
Merge pull request #875 from byteom/issue-870
Browse files Browse the repository at this point in the history
Fix issue #870 At carrier page - Date Input Field Allows Invalid Six-…
  • Loading branch information
PriyaGhosal authored Oct 30, 2024
2 parents 03f9288 + c458259 commit 0f76d06
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion careers.html
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ <h2 class="text-center mb-5 fw-bold">Apply for Internship</h2>

<div class="form-group mb-3">
<label class="fw-bold" for="start-date">Start Date: </label>
<input type="date" id="start-date" name="start-date" required>
<input type="date" id="start-date" name="start-date" required min="0000-01-01" max="9999-12-31" pattern="\d{4}-\d{2}-\d{2}" title="Please enter a date with a 4-digit year">
</div>
<div class="form-group mb-3">
<label class="fw-bold" for="cv-linkedin">Link to CV/LinkedIn: </label>
Expand Down Expand Up @@ -187,6 +187,18 @@ <h2 class="text-center mb-5 fw-bold">Apply for Internship</h2>
this.reset();
});
</script>

<script>
document.getElementById('start-date').addEventListener('input', function () {
const inputDate = this.value;
const year = inputDate.split('-')[0];
if (year.length > 4) {
this.value = inputDate.slice(0, 4) + inputDate.slice(5); // Trims additional digits
}
});
</script>


</body>

</html>

0 comments on commit 0f76d06

Please sign in to comment.