2
0
mirror of https://github.com/frappe/books.git synced 2024-11-10 07:40:55 +00:00
books/utils/format.js

20 lines
566 B
JavaScript
Raw Normal View History

2018-02-14 12:50:56 +00:00
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;
}
}