Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <%*
- function pad(n) {
- return n.toString().padStart(2, "0");
- }
- function fmtDate(d) {
- var yyyy = d.getFullYear();
- var mm = pad(d.getMonth() + 1);
- var dd = pad(d.getDate());
- var dArr = [ yyyy, mm, dd ];
- return(dArr.join('-'));
- }
- function lastDay(a) {
- if (typeof(a) === 'undefined' || a === '') {
- var d = new Date();
- } else {
- var d = new Date(a + ' 12:00:00');
- if (d.toString() === 'Invalid Date') {
- console.log('invalid date');
- return
- }
- }
- var lastDay = new Date(d.getFullYear(),d.getMonth()+1,0);
- lastDate = fmtDate(lastDay)
- lastDay = lastDay.getDate()
- return lastDate // change to "lastDay" to output day only
- } %><% lastDay(tp.file.selection())%>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement