mirror of https://gitlab.crans.org/bde/nk20
Merge branch 'fix-amounts' into 'beta'
Round amounts to the nearest integer rather than take the floor See merge request bde/nk20!167
This commit is contained in:
commit
0d5f6c0332
|
@ -243,7 +243,7 @@ $('#btn_transfer').click(function () {
|
||||||
error = true
|
error = true
|
||||||
}
|
}
|
||||||
|
|
||||||
const amount = Math.floor(100 * amount_field.val())
|
const amount = Math.round(100 * amount_field.val())
|
||||||
if (amount > 2147483647) {
|
if (amount > 2147483647) {
|
||||||
amount_field.addClass('is-invalid')
|
amount_field.addClass('is-invalid')
|
||||||
$('#amount-required').html('<strong>' + gettext('The amount must stay under 21,474,836.47 €.') + '</strong>')
|
$('#amount-required').html('<strong>' + gettext('The amount must stay under 21,474,836.47 €.') + '</strong>')
|
||||||
|
|
|
@ -7,8 +7,8 @@
|
||||||
* @returns {string}
|
* @returns {string}
|
||||||
*/
|
*/
|
||||||
function pretty_money (value) {
|
function pretty_money (value) {
|
||||||
if (value % 100 === 0) { return (value < 0 ? '- ' : '') + Math.floor(Math.abs(value) / 100) + ' €' } else {
|
if (value % 100 === 0) { return (value < 0 ? '- ' : '') + Math.round(Math.abs(value) / 100) + ' €' } else {
|
||||||
return (value < 0 ? '- ' : '') + Math.floor(Math.abs(value) / 100) + '.' +
|
return (value < 0 ? '- ' : '') + Math.round(Math.abs(value) / 100) + '.' +
|
||||||
(Math.abs(value) % 100 < 10 ? '0' : '') + (Math.abs(value) % 100) + ' €'
|
(Math.abs(value) % 100 < 10 ? '0' : '') + (Math.abs(value) % 100) + ' €'
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue