Skip to content

Commit

Permalink
Fixed Issue #11417: Dates not calculating properly
Browse files Browse the repository at this point in the history
dev Please look out for usages of the deprecated jstoolbox/date.js library, though it may be removed in the future
dev updated strtotime out of the php.js library
  • Loading branch information
Markus Flür committed Jul 22, 2016
1 parent a805905 commit 349e008
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions application/helpers/expressions/em_core_helper.php
Expand Up @@ -1269,7 +1269,7 @@ public function GetJavaScriptEquivalentOfExpression()
elseif ($i+1<$numTokens && $tokens[$i+1][2] == 'ASSIGN')
{
$jsName = $this->GetVarAttribute($token[0],'jsName','');
$stringParts[] = "$('" . $jsName . "').val()";
$stringParts[] = "document.getElementById('" . $jsName . "').value";
if ($tokens[$i+1][0] == '+=')
{
// Javascript does concatenation unless both left and right side are numbers, so refactor the equation
Expand Down Expand Up @@ -1361,8 +1361,8 @@ public function GetJavascriptTestforExpression($expected,$num)
$jsParts = array();
$jsParts[] = "val = " . $jsmultiline_expr . ";\n";
$jsParts[] = "klass = (LEMeq(addslashes(val),'" . $jsmultiline_expected . "')) ? 'ok' : 'error';\n";
$jsParts[] = "$('test_" . $num . "').html(val);\n";
$jsParts[] = "$('test_" . $num . "').addClass(klass);\n";
$jsParts[] = "document.getElementById('test_" . $num . "').innerHTML=(val);\n";
$jsParts[] = "document.getElementById('test_" . $num . "').className=klass;\n";
return implode('',$jsParts);

}
Expand All @@ -1377,9 +1377,9 @@ public function GetJavaScriptFunctionForReplacement($questionNum, $name,$eqn)
$jsParts = array();
// $jsParts[] = "\n // Tailor Question " . $questionNum . " - " . $name . ": { " . $eqn . " }\n";
$jsParts[] = " try{\n";
$jsParts[] = " $('" . $name . "').html(LEMfixnum(\n ";
$jsParts[] = " document.getElementById('" . $name . "').innerHTML=LEMfixnum(\n ";
$jsParts[] = $this->GetJavaScriptEquivalentOfExpression();
$jsParts[] = "));\n";
$jsParts[] = ");\n";
$jsParts[] = " } catch (e) { console.log(e); }\n";
return implode('',$jsParts);
}
Expand Down

0 comments on commit 349e008

Please sign in to comment.