helpers.js | |
---|---|
exports.padComponent = function (component) {
return component <= 9 ? '0' + component : '' + component;
}; | |
Converts a date to a string in YYYYMMDD format
| exports.toYYYYMMDD = function (theDate) {
var month = this.padComponent(theDate.getMonth() + 1);
return theDate.getUTCFullYear() +
month +
this.padComponent(theDate.getDate()) +
'';
}; |
Capitalises the first character of a string
| exports.capitalize = function (str) {
return str.charAt(0).toUpperCase() + str.slice(1);
};
|