Commit a258ebe5 authored by Irina Ivanova's avatar Irina Ivanova

Fix returnError()

parent edf0a751
# CHANGELOG
### 2.0 29.01.2017
* Refactor the code
* Change style and design
......@@ -5,7 +5,7 @@ The extension calculates how many days and hours are between two datetimes; or c
* **[Install](https://chrome.google.com/webstore/detail/span-of-datetimes/eifmojfjlkacjfnaeagfnfjgpajanphn "Install")** last version from Google Store
# Questions and Comments
Any questions or comments are welcome! You can write me an e-mail on [irina.ivanova@protonmail.com](irina.ivanova@protonmail.com "irina.ivanova@protonmail.com") or leave a comment on this page.
Any questions or comments are welcome! You can write me an e-mail on [irina.ivanova@protonmail.com](irina.ivanova@protonmail.com) or create an issue here.
# Description
Extension is build for software testers to calculate spans or differences between two datetimes.
......@@ -43,7 +43,7 @@ You can configure hot-keys for extension in the Google Chrome:
* open the extensions tab - `chrome://extensions`
* link "Configure commands" at the bottom
* choose an extension and type a shortcut
* Now You can use it completely without a mouse!
* now You can use it completely without a mouse!
# Posts About spanD
* *April 12, 2014* [spanD v1.1](http://ivanova-irina.blogspot.com/2014/04/spand-v11.html "spanD v1.1")
......
......@@ -28,11 +28,11 @@ function setSpanVariables() {
function checkMandatorySpanFields(inputStartDate, inputEndDate) {
if (inputStartDate === "" && inputEndDate === "")
returnError("Insert dates", "startDate");
returnError("Insert dates");
else if (inputStartDate === "")
returnError("Insert start date", "startDate");
returnError("Insert start date");
else if (inputEndDate === "")
returnError("Insert end date", "endDate");
returnError("Insert end date");
}
function setTime(id, date) {
......@@ -74,11 +74,11 @@ function setDatetime(globalVarName, date) {
function checkDateFormat(type, date) {
if (type === "start" && date === null)
returnError("Invalid start datetime format", "start");
returnError("Invalid start datetime format");
else if (type === "end" && date === null)
returnError("Invalid end datetime format", "end");
returnError("Invalid end datetime format");
else if (type === "date" && date === null)
returnError("Invalid datetime format", "date");
returnError("Invalid datetime format");
}
function setAdditionVariables() {
......@@ -106,7 +106,7 @@ function setAdditionVariables() {
function checkMandatoryAdditionFileds(inputDate) {
if (inputDate === "")
returnError("Insert datetime", "date");
returnError("Insert datetime");
}
function setNullDays(inputDays) {
......@@ -119,7 +119,7 @@ function setNullDays(inputDays) {
function checkDaysFormat(inputDays) {
if (daysAndHoursRegexp.exec(inputDays) === null || daysAndHoursRegexp.exec(inputDays)[0] != inputDays)
returnError("Invalid days format", "days");
returnError("Invalid days format");
}
function setNullHours(inputHours) {
......@@ -132,7 +132,7 @@ function setNullHours(inputHours) {
function checkHoursFormat(inputHours) {
if (daysAndHoursRegexp.exec(inputHours) === null || daysAndHoursRegexp.exec(inputHours)[0] != inputHours)
returnError("Invalid hours format", "hours");
returnError("Invalid hours format");
}
function setNullMinutes(inputMinutes) {
......@@ -145,5 +145,5 @@ function setNullMinutes(inputMinutes) {
function checkMinutesFormat(inputMinutes) {
if (daysAndHoursRegexp.exec(inputMinutes) === null || daysAndHoursRegexp.exec(inputMinutes)[0] != inputMinutes)
returnError("Invalid minutes format", "minutes");
returnError("Invalid minutes format");
}
function returnError(errorText, element) {
function returnError(errorText) {
setErrorText(errorText);
throw "";
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment