mirror of
https://github.com/Jermolene/TiddlyWiki5.git
synced 2025-12-06 02:30:46 -08:00
fix: formatDateString with [UTC]xxx didn't use passed date (#6615)
* fix: formatDateString with [UTC]xxx didn't use passed date * test: for formatDateString UTC * fix: not possible to test internal date without hijack Expected '20220410073037515' to be '20220410073037516'. * fix: hour
This commit is contained in:
parent
b3b3020d99
commit
cc25e1f5b4
2 changed files with 2 additions and 1 deletions
|
|
@ -448,7 +448,7 @@ exports.formatDateString = function(date,template) {
|
|||
// 'return raw UTC (tiddlywiki style) date string.'
|
||||
if(t.indexOf("[UTC]") == 0 ) {
|
||||
if(t == "[UTC]YYYY0MM0DD0hh0mm0ssXXX")
|
||||
return $tw.utils.stringifyDate(new Date());
|
||||
return $tw.utils.stringifyDate(date || new Date());
|
||||
var offset = date.getTimezoneOffset() ; // in minutes
|
||||
date = new Date(date.getTime()+offset*60*1000) ;
|
||||
t = t.substr(5) ;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue