Files
bodyshop/jsreport/data/_globals/helpers.js/content.js

25 lines
532 B
JavaScript

const moment = require('moment')
function formatReportDate (date) {
return moment(date).format('YYYY MMMM DD')
}
function now() {
return new Date().toLocaleDateString()
}
function nowPlus20Days() {
var date = new Date()
date.setDate(date.getDate() + 20);
return date.toLocaleDateString();
}
function total(items) {
var sum = 0
items.forEach(function (i) {
console.log('Calculating item ' + i.name + '; you should see this message in debug run')
sum += i.price
})
return sum
}