Add debug statements
This commit is contained in:
parent
1dabbe0368
commit
6acbeae358
25
index.html
25
index.html
|
@ -401,6 +401,10 @@
|
||||||
|
|
||||||
const centuryInput = new class extends ValidatableInput {
|
const centuryInput = new class extends ValidatableInput {
|
||||||
isValid(value) {
|
isValid(value) {
|
||||||
|
console.log("# Validate century");
|
||||||
|
console.log(`Input: ${value}`);
|
||||||
|
console.log(`Expanded: ${DoomsdayDate.expandDayString(value)}`);
|
||||||
|
console.log(`Expected: ${quizDate.getCenturyAnchorString()}`);
|
||||||
return DoomsdayDate.expandDayString(value) === quizDate.getCenturyAnchorString();
|
return DoomsdayDate.expandDayString(value) === quizDate.getCenturyAnchorString();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -419,6 +423,10 @@
|
||||||
}($("#century-input"), $("#century-title-label"), $("#century-submit"));
|
}($("#century-input"), $("#century-title-label"), $("#century-submit"));
|
||||||
const yearInput = new class extends ValidatableInput {
|
const yearInput = new class extends ValidatableInput {
|
||||||
isValid(value) {
|
isValid(value) {
|
||||||
|
console.log("# Validate year");
|
||||||
|
console.log(`Input: ${value}`);
|
||||||
|
console.log(`Expanded: ${DoomsdayDate.expandDayString(value)}`);
|
||||||
|
console.log(`Expected: ${quizDate.getYearAnchorString()}`);
|
||||||
return DoomsdayDate.expandDayString(value) === quizDate.getYearAnchorString();
|
return DoomsdayDate.expandDayString(value) === quizDate.getYearAnchorString();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -437,6 +445,10 @@
|
||||||
}($("#year-input"), $("#year-title-label"), $("#year-submit"));
|
}($("#year-input"), $("#year-title-label"), $("#year-submit"));
|
||||||
const dayInput = new class extends ValidatableInput {
|
const dayInput = new class extends ValidatableInput {
|
||||||
isValid(value) {
|
isValid(value) {
|
||||||
|
console.log("# Validate day");
|
||||||
|
console.log(`Input: ${value}`);
|
||||||
|
console.log(`Expanded: ${DoomsdayDate.expandDayString(value)}`);
|
||||||
|
console.log(`Expected: ${quizDate.getWeekdayString()}`);
|
||||||
return DoomsdayDate.expandDayString(value) === quizDate.getWeekdayString();
|
return DoomsdayDate.expandDayString(value) === quizDate.getWeekdayString();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -455,7 +467,11 @@
|
||||||
}($("#day-input"), $("#day-title-label"), $("#day-submit"));
|
}($("#day-input"), $("#day-title-label"), $("#day-submit"));
|
||||||
|
|
||||||
const resetButton = $("#reset-button");
|
const resetButton = $("#reset-button");
|
||||||
resetButton.addEventListener("click", () => reloadQuiz());
|
resetButton.addEventListener("click", () => {
|
||||||
|
console.log(" ");
|
||||||
|
console.log(" ");
|
||||||
|
reloadQuiz();
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -463,6 +479,13 @@
|
||||||
*/
|
*/
|
||||||
function reloadQuiz() {
|
function reloadQuiz() {
|
||||||
quizDate = DoomsdayDate.random();
|
quizDate = DoomsdayDate.random();
|
||||||
|
console.log("# Reset");
|
||||||
|
console.log(`New date: ${quizDate.date.toISOString().substr(0, 10)}`);
|
||||||
|
console.log(`Century#: ${quizDate.getCentury()}`);
|
||||||
|
console.log(`Century: ${quizDate.getCenturyAnchorString()}`);
|
||||||
|
console.log(`Year: ${quizDate.getYearAnchorString()}`);
|
||||||
|
console.log(`Day: ${quizDate.getWeekdayString()}`);
|
||||||
|
|
||||||
centuryInput.reset();
|
centuryInput.reset();
|
||||||
yearInput.reset();
|
yearInput.reset();
|
||||||
dayInput.reset();
|
dayInput.reset();
|
||||||
|
|
Loading…
Reference in New Issue