2
0
mirror of https://github.com/frappe/books.git synced 2024-12-23 11:29:03 +00:00
books/utils/format.js
2018-02-14 18:20:56 +05:30

20 lines
566 B
JavaScript

const number_format = require('./number_format');
module.exports = {
format(value, field) {
if (field.fieldtype==='Currency') {
value = number_format.format_number(value);
} else if (field.fieldtype==='Date') {
if (value instanceof Date) {
value = value.toISOString().substr(0, 10);
}
} else {
if (value===null || value===undefined) {
value = '';
} else {
value = value + '';
}
}
return value;
}
}