Further refine date format tokens for day of year and weekday number

See f223896c26
This commit is contained in:
jeremy@jermolene.com
2021-09-23 10:09:27 +01:00
parent 6d17505f7b
commit 59a53e695b
2 changed files with 8 additions and 8 deletions

View File

@@ -383,18 +383,18 @@ exports.formatDateString = function(date,template) {
[/^0WW/, function() {
return $tw.utils.pad($tw.utils.getWeek(date));
}],
[/^0dddd/, function() {
[/^0ddddd/, function() {
return $tw.utils.pad(Math.floor((date - new Date(date.getFullYear(), 0, 0)) / 1000 / 60 / 60 / 24),3);
}],
[/^dddd/, function() {
[/^ddddd/, function() {
return Math.floor((date - new Date(date.getFullYear(), 0, 0)) / 1000 / 60 / 60 / 24);
}],
[/^dddd/, function() {
return [7,1,2,3,4,5,6][date.getDay()];
}],
[/^ddd/, function() {
return $tw.language.getString("Date/Short/Day/" + date.getDay());
}],
[/^dd/, function() {
return [7,1,2,3,4,5,6][date.getDay()];
}],
[/^mmm/, function() {
return $tw.language.getString("Date/Short/Month/" + (date.getMonth() + 1));
}],