option for using UTC (ticket #651)

0 views
Skip to first unread message

FND

unread,
May 23, 2008, 7:04:33 AM5/23/08
to TiddlyWikiDev
All,

It would be useful to have an option for using UTC on tiddlers'
timestamps (created/modified):
http://trac.tiddlywiki.org/ticket/651
There's a [tw] thread explaining one use case for this:
http://groups.google.com/group/TiddlyWiki/t/b29de42520acee8c

I have tried the following:
http://tiddlywiki.pastebin.com/f1c0a2b7b
However, that breaks the respective tiddler's created and modified
properties - but I can't figure out why (debugging correctly shows date
objects for both cases in Tiddler.prototype.assign()... ).

Any help would be appreciated!


-- F.

FND

unread,
May 23, 2008, 11:46:26 AM5/23/08
to Tiddly...@googlegroups.com
> I have tried the following:
> http://tiddlywiki.pastebin.com/f1c0a2b7b

That's just the diff - the full functions might be more helpful:
http://tiddlywiki.pastebin.com/f72bd5d82


-- F.

JayFresh - http://jayfresh.wordpress.com

unread,
May 23, 2008, 12:38:27 PM5/23/08
to TiddlyWikiDev
Try this:
http://tiddlywiki.pastebin.com/m28f7cd6e

The problem is that modified.toUTC() doesn't actually return anything,
so this.modified = modified.toUTC() sets this.modified to undefined.

I've fixed it by returning 'this' from the function.


J.

FND

unread,
May 23, 2008, 1:19:16 PM5/23/08
to Tiddly...@googlegroups.com
Thanks Jon!

> The problem is that modified.toUTC() doesn't actually return anything,
> so this.modified = modified.toUTC() sets this.modified to undefined.

Oh my - I had noticed the missing return as well, but had only tried a
return on the same line:
return this.setMinutes(this.getMinutes() + this.getTimezoneOffset());
Oddly enough, this seemed to produce the correct results during
debugging (thus my confusion) - so I probably wasn't being careful
enough there...

The toUTC() function was inspired by Helma (via Google Code search):
http://google.com/codesearch?q=Helma+toUTC+lang%3Ajavascript
Helma uses a BSD-style license:
http://dev.helma.org/license/
Is this function small/simple/unoriginal enough so I don't have to
include Helma's copyright notice in our adaptation?


-- F.

jayfresh

unread,
Jun 4, 2008, 5:41:10 AM6/4/08
to TiddlyWikiDev

> Is this function small/simple/unoriginal enough so I don't have to
> include Helma's copyright notice in our adaptation?

I think so - I rewrote it during my debugging anyway...
Reply all
Reply to author
Forward
0 new messages