Browse Source

Fix date parsing error, correct minor typo

Fix error that caused the date of single-digit months and days to be posted as 2020-1-2 instead of the canonical 2020-01-02.
Alessandro De Gennaro 4 years ago
parent
commit
39e94b98a9
1 changed files with 9 additions and 7 deletions
  1. 9 7
      lcmlog

+ 9 - 7
lcmlog

@@ -191,10 +191,6 @@ method_post()
 			 MONTH=$((10#$MONTH))
 		done
 	done
-	if (( ${#MONTH} == 1 )); then
-		MONTH=0$MONTH
-		MONTH=$((10#$MONTH))
-	fi
 
 	# Day
 	echo "Day? (dd)"
@@ -246,9 +242,15 @@ method_post()
 			done
 		done
 	fi
+
+	## Turn month and day in correctly strings
+	if (( ${#MONTH} == 1 )); then
+		MONTH=0$MONTH
+	fi
+
 	if (( ${#DAY} == 1 )); then
-		DAY=0$DAY
-		DAY=$((10#$DAY))
+		DAY="0$DAY"
+		#DAY=$((10#$DAY))
 	fi
 
 	# Morning or afternoon shift
@@ -407,7 +409,7 @@ if [ "$METHOD" == "UPDATE" ]; then
 	echo "or if some of the log files get renamed or corrupted."
 	echo "It assumes that all the log files are correctly formatted."
 	echo
-	echo "Are you shure? [y|n] "
+	echo "Are you sure? [y|n] "
 	read ANSWER
 
 	while [ -z $ANSWER ]; do