--------- slightly OT sry ----------------
I think my wording was wrong.

Tiddlywiki5 modified and created information at the moment has this format: 
modified: 20131214093453953

It allows proper sorting by: created or modified, but it is extremely hard 
to read by humans and it doesn't contain any unambiguous Information about 
how it has to be interpreted.

If a plugin author want's to use a timestamp in a custom field for there 
own plugin, they actually have to dig deep into the code, to see how to 
create this timestamp. If they use the naive approach and create the above 
string with there local time, it will be wrong. So unusable for others. 

Timestamp are created as a date object and there are a lot of serialisation 
functions [1]
eg:
time.toString() creates a localized time string ... "Tue Feb 25 2014 
22:25:35 GMT+0100 (CET)" ... not easy sortable out of the box and not UTC 
no miliseconds
time.toISOString() ... "2014-02-25T21:25:35.436Z"   ... creates an UTC type 
timestamp ... defined at: ISO 8601 ... sortable out of the box. 
time.toJSON() ... "2014-02-25T21:25:35.436Z"  ... same as toISO

None of the built in javascript functions produce the "modified or created" 
timestamp format.  .... Also you can't feed the existing string to 
eg: var x = new Date("20131214093453953") to do date calculations. You have 
to convert it to a usable format first. :(

But if you use var x = new Date("2014-02-25T21:25:35.436Z" ) and 
x.toString()  I get "Tue Feb 25 2014 22:25:35 GMT+0100 (CET)", which 
actually is my local time ... simple and not error prone at all. see this 
topic: TWC Editing dates for a storyline [3], 

So imo in js there is only the Date.toISOSting() function, that lets an 
inexperienced plugin author easily create a timestamp that is human 
readable, human constructable, has a resolution in the milliseconds and 
contains information about, how it has to be interpreted.

There are some utility functions for date handling in TW5, but the risk to 
use them in a wrong way is very high. ...

So my suggestion was to use the ISO 8601 string in the modified and created 
field, because its easier to read and deal with it, than the existing one. 

There has been an other topic [4]. So I did create an issue at github [5]

IMHO have fun!
-mario

[1] http://en.wikipedia.org/wiki/ISO_8601
[2] 
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date
[3] https://groups.google.com/d/msg/tiddlywiki/_rZdTR94GY4/xDAU_2uGCGYJ
[4] 
https://groups.google.com/forum/?fromgroups=#!topic/tiddlywiki/SOEPWuxejF8
[5] https://github.com/Jermolene/TiddlyWiki5/issues/280

-- 
You received this message because you are subscribed to the Google Groups 
"TiddlyWikiDev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/tiddlywikidev.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to