[TW5] Question about regexp and UTC problem.

114 views
Skip to first unread message

Changhoon Lee

unread,
Oct 28, 2015, 1:47:47 AM10/28/15
to tiddl...@googlegroups.com
I have quick question about regexp to search date fields.

My local time is 10 hours ahead from UTC.
If I create tiddler on 2015-Oct-28 8:00 AM, then the 'created' field will get 2015-Oct-27 22:00 PM.
If I search [regexp:created[^20151028]] in the filter, this tiddler would be not on the resault.
Is there any way of fixing this? :)

Lee

Mark S.

unread,
Oct 29, 2015, 11:17:55 AM10/29/15
to TiddlyWiki
I don't think there is any reasonable way to filter for this. It would require a special filter or javascript macro that knows how to manipulate date stamps.

One workaround might be to create your own "New Tiddler" button that would create its own date field using the local time. Kind of messy.

So, I wonder,  for those of us not conveniently living AT UTC 0 , is there a way to change the default creation date stamp to reflect local (locale?) time?

Mark

Tobias Beer

unread,
Oct 29, 2015, 12:56:26 PM10/29/15
to tiddl...@googlegroups.com
Hi Changhoon Lee,

If I create tiddler on 2015-Oct-28 8:00 AM, then the 'created' field will get 2015-Oct-27 22:00 PM.

At first I was wondering why that is but then I got to accept the proposition.

Here are two issues on GitHub about this:

#190 It should be possible to display fields in local time
https://github.com/Jermolene/TiddlyWiki5/issues/190

#1096 "sameday" operator inconsistent timezone handling
https://github.com/Jermolene/TiddlyWiki5/issues/1096

With a date field I think we should always:

  • write as UTC — as that is how it's implemented now
  • read as local time — required due to the above

If there are occurrences where we don't respect both conventions, I'd consider it a bug that needs fixing, like #1096.

~

Therefore, the regexp filter won't do any good

as it knows nothing of datetime conversions / date handling.


While not too pretty, 
for now, you could use the approach of cmari

taking an offset into account via the sameday filter.

Best wishes,

— tb
Message has been deleted

Mark S.

unread,
Oct 29, 2015, 3:07:14 PM10/29/15
to TiddlyWiki
Why should TW5 stick with UTC? Maintaining a legacy that only works for 1/24 of the world is somewhat harsh.

At the very least, users should be able to configure how they want their time stamps kept.

I'm thinking that someone has probably already made a Journal widget/button that can save in local time?


Mark

On Tuesday, October 27, 2015 at 10:47:47 PM UTC-7, Changhoon Lee wrote:

Tobias Beer

unread,
Oct 29, 2015, 3:28:08 PM10/29/15
to tiddl...@googlegroups.com
Hi Mark,
 
Why should TW5 stick with UTC? Maintaining a legacy that only works for 1/24 of the world is somewhat harsh.

There's no legacy in that. It ensures that all wikis talk about the same time, no matter from where you look at it. It does not mean that TiddlyWiki thinks all users sit in Greenwich. For example, if I create a tiddler now that would be stamped in my local time, and you would look at it five minutes later in your local time, you'd think I've already posted it 8 hours ago. Not too cool, is it? :D

At the very least, users should be able to configure how they want their time stamps kept.

Perhaps. Not so sure. It would possibly be easier for literally typing dates into date fields but then I don't do that.
 
I'm thinking that someone has probably already made a Journal widget/button that can save in local time?

It's not a bug, it's a feature. The bug(s) would be where we're not (always) reading date fields correctly, i.e. in filters like sameday or eachday.

Best wishes,

— tb

Changhoon Lee

unread,
Oct 29, 2015, 10:42:30 PM10/29/15
to TiddlyWiki
Thank you so much Tobias Beer for your answer!

Sameday filter is the exactly what I was looking for!

2015년 10월 30일 금요일 오전 3시 56분 26초 UTC+11, Tobias Beer 님의 말:
Reply all
Reply to author
Forward
0 new messages