Actions
Bug #87060
closedAdminpanel resetting simulate time javascript error
Status:
Closed
Priority:
Should have
Assignee:
-
Category:
AdminPanel
Target version:
-
Start date:
2018-12-03
Due date:
% Done:
100%
Estimated time:
TYPO3 Version:
9
PHP Version:
Tags:
Complexity:
easy
Is Regression:
Sprint Focus:
Description
Admin panel:
After selecting a date, it is currently impossible to reset that date to be empty.
Solution:
In adminpanel/Resources/Public/JavaScript/Modules/Preview.js
Change updateDateField to:
var updateDateField = function () {
var dateVal = document.getElementById('preview_simulateDate-date-hr').value;
var timeVal = document.getElementById('preview_simulateDate-time-hr').value;
if (dateVal && !timeVal) {
timeVal = "00:00";
}
if(!dateVal) {
// If no date val, assume the date should be reset, regardless of timeVal
targetField.value = "";
} else {
var stringDate = dateVal + " " + timeVal;
var date = new Date(stringDate);
targetField.value = date.toISOString();
}
};
Essentially this just removes lines 15-18 from the code:
if (!dateVal && timeVal) {
var tempDate = new Date();
dateVal = tempDate.getDate() + "-" + tempDate.getMonth() + "-" + tempDate.getFullYear();
}
Bonus point: If the code block above doesn't get removed, it at least has to get modified to:
dateVal = tempDate.getFullYear() + "-" + tempDate.getMonth() + "-" + tempDate.getDate();as the format is wrong :)
Updated by Andreas Kienast over 5 years ago
- Status changed from New to In Progress
Well, in JavaScript you need a date to be able to have a valid Date object, even if you only need the time. But there's indeed an issue with the date calculation.
Updated by Gerrit Code Review over 5 years ago
- Status changed from In Progress to Under Review
Patch set 1 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/59047
Updated by Andreas Fernandez over 5 years ago
- Status changed from Under Review to Resolved
- % Done changed from 0 to 100
Applied in changeset 90fc5cd48ec6aaf687c4fa8ff8f187a156361819.
Actions