Skip to content

Commit

Permalink
Merge pull request #497 from Tom-TBT/defaultname
Browse files Browse the repository at this point in the history
Default figure filename to YYYY-MM-DD_hh-mm-ss
  • Loading branch information
will-moore authored May 3, 2023
2 parents 45118df + 9bf346e commit 4d23a44
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/js/models/figure_model.js
Original file line number Diff line number Diff line change
Expand Up @@ -560,9 +560,14 @@
},

getDefaultFigureName: function() {
const padL = (nr) => `${nr}`.padStart(2, '0');
var d = new Date(),
dt = d.getFullYear() + "-" + (d.getMonth()+1) + "-" +d.getDate(),
tm = d.getHours() + ":" + d.getMinutes() + ":" + d.getSeconds();
dt = [d.getFullYear(),
padL(d.getMonth()+1),
padL(d.getDate())].join('-'),
tm = [padL(d.getHours()),
padL(d.getMinutes()),
padL(d.getSeconds())].join('-');
return "Figure_" + dt + "_" + tm;
},

Expand Down

0 comments on commit 4d23a44

Please sign in to comment.