Skip to content

Commit

Permalink
Maintenance: Improve the timestamp function in a QUnit test.
Browse files Browse the repository at this point in the history
  • Loading branch information
dvuckovic committed Dec 2, 2022
1 parent 1dc72a3 commit 70f3400
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion public/assets/tests/qunit/ui.js
Original file line number Diff line number Diff line change
Expand Up @@ -342,6 +342,11 @@ QUnit.test("check pretty date", assert => {
yfull = date.getFullYear()
M = date.getMinutes()
H = date.getHours()
l = (H + 11) % 12 + 1
if (l < 10) {
l = ' ' + l
}
P = H >= 12 ? 'pm' : 'am'

// for less than 6 days
// weekday HH::MM
Expand All @@ -350,7 +355,7 @@ QUnit.test("check pretty date", assert => {
else if (current.getYear() == date.getYear())
string = weekday + ' ' + date.getDate() + '. ' + month + ' ' + H + ':' + (M < 10 ? '0':'') + M
else
string = weekday + ' ' + (m < 10 ? '0':'') + m + '/' + (d < 10 ? '0':'') + d + '/' + (yfull) + ' ' + (H < 10 ? '0':'') + H + ':' + (M < 10 ? '0':'') + M
string = weekday + ' ' + (m < 10 ? '0':'') + m + '/' + (d < 10 ? '0':'') + d + '/' + (yfull) + ' ' + l + ':' + (M < 10 ? '0':'') + M + ' ' + P
return string;
}

Expand Down

0 comments on commit 70f3400

Please sign in to comment.