Skip to content

Commit

Permalink
Merge pull request #1570 from paul53/patch-43
Browse files Browse the repository at this point in the history
Update sandbox.js
  • Loading branch information
klein0r committed May 10, 2024
2 parents 3ea8d40 + b8b6e2f commit 00ec1a8
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion lib/sandbox.js
Expand Up @@ -3392,6 +3392,8 @@ function sandBox(script, name, verbose, debug, context) {
const minute = 60 * second;
const hour = 60 * minute;
const day = 24 * hour;
const neg = diff < 0;
diff = Math.abs(diff);

if (/DD|TT|ДД|D|T|Д/.test(text)) {
const days = Math.floor(diff / day);
Expand Down Expand Up @@ -3439,7 +3441,7 @@ function sandBox(script, name, verbose, debug, context) {

sandbox.verbose && sandbox.log(`formatTimeDiff(format=${format}, text=${text})`, 'debug');

return text;
return neg ? `-${text}` : text;
},
getDateObject: function (date) {
if (isObject(date)) {
Expand Down

0 comments on commit 00ec1a8

Please sign in to comment.