Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes #579: Resolved entering date issue #608

Merged
merged 1 commit into from
Oct 25, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 28 additions & 2 deletions buy.html
Original file line number Diff line number Diff line change
Expand Up @@ -583,8 +583,9 @@ <h2>Book Your Ticket</h2>
</div>
<div class="form-group">
<label for="journeyDate">Date of Journey</label>
<input type="date" id="journeyDate" name="journeyDate" required>
</div>
<input type="date" id="journeyDate" name="journeyDate" required max="9999-12-31">
</div>

<div class="form-group">
<label for="journeyTime">Time of Journey</label>
<input type="time" id="journeyTime" name="journeyTime" required>
Expand Down Expand Up @@ -849,7 +850,32 @@ <h4>FIND US</h4>
const progressHeight = (window.scrollY / totalHeight) * 100;
scrollProgressBar.style.width = progressHeight + '%';
});






</script>


<script>
// Restrict the input to only valid dates (YYYY-MM-DD)
document.getElementById('journeyDate').addEventListener('input', function() {
// Enforce a strict date pattern of YYYY-MM-DD
const datePattern = /^\d{4}-\d{2}-\d{2}$/;
if (!datePattern.test(this.value)) {
// Remove any invalid characters from the input
this.value = this.value.slice(0, 10);
}
});
</script>






<script src="app.js"></script>
<div class="gtranslate_wrapper"></div>
<script>window.gtranslateSettings = {"default_language":"en","detect_browser_language":true,"wrapper_selector":".gtranslate_wrapper"}</script>
Expand Down
Loading