mirror of
https://github.com/frappe/books.git
synced 2024-11-13 00:46:28 +00:00
20 lines
566 B
JavaScript
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;
|
|
}
|
|
} |