You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Several years later but but it took me awhile to figure out how to do this with templates in a .grenrc.js file so I thought I would share what I used to convert DD/MM/YYYY to YYYY/MM/DD
"template": { release: function (placeholders) { var parts = placeholders.date.split("/"); var dt = new Date(parseInt(parts[2], 10), parseInt(parts[1], 10) - 1, parseInt(parts[0], 10)); return '## ' + placeholders.release + ' (' + dt.toISOString().substring(0, 10).replace(/-/g,"/") +")\n" + placeholders.body; } }
Activity
alexcanessa commentedon Nov 30, 2016
@phun-ky could be related to #23. Definitely a good suggestion.
alexcanessa commentedon Mar 12, 2017
We can add functions as template properties, so to evaluate wherever you want to customise.
P.S. The default date format is DD/MM/YYYY right now.
urbanyeti commentedon Dec 9, 2021
Several years later but but it took me awhile to figure out how to do this with templates in a .grenrc.js file so I thought I would share what I used to convert DD/MM/YYYY to YYYY/MM/DD
"template": { release: function (placeholders) { var parts = placeholders.date.split("/"); var dt = new Date(parseInt(parts[2], 10), parseInt(parts[1], 10) - 1, parseInt(parts[0], 10)); return '## ' + placeholders.release + ' (' + dt.toISOString().substring(0, 10).replace(/-/g,"/") +")\n" + placeholders.body; } }