mirror of
https://github.com/Jermolene/TiddlyWiki5
synced 2025-11-12 13:33:44 +00:00
Add support for working with negative dates
See discussion https://groups.google.com/g/tiddlywiki/c/aHlyaHr93Io/m/vGcDa6lxAgAJ
This commit is contained in:
@@ -305,7 +305,12 @@ $tw.utils.stringifyDate = function(value) {
|
||||
// Parse a date from a UTC YYYYMMDDHHMMSSmmm format string
|
||||
$tw.utils.parseDate = function(value) {
|
||||
if(typeof value === "string") {
|
||||
var year = parseInt(value.substr(0,4),10),
|
||||
var negative = 1;
|
||||
if(value.charAt(0) === "-") {
|
||||
negative = -1;
|
||||
value = value.substr(1);
|
||||
}
|
||||
var year = parseInt(value.substr(0,4),10) * negative,
|
||||
d = new Date(Date.UTC(year,
|
||||
parseInt(value.substr(4,2),10)-1,
|
||||
parseInt(value.substr(6,2),10),
|
||||
|
||||
Reference in New Issue
Block a user