Clipboard hook- convert dates into TiddlyWiki format

44 views
Skip to first unread message

thor...@gmail.com

unread,
Nov 15, 2021, 12:58:27 AM11/15/21
to TiddlyWiki
TiddlyWiki has it's own format for representing dates for `created` and `modified` fields. To be consistent, I wanted to use this date format for other fields, but didn't feel like manually converting them myself.

So I wrote a Python script and uploaded it for others to try :): https://github.com/cr1901/tw-timestamp

To install, `git clone https://github.com/cr1901/tw-timestamp`, and then use `pip install .` or `pip install -e .` (if you want to hack on it) to add a `tw-timestamp` command to your path. I will upload a package to PyPI soon enough, but I'd like people to test-drive this first to flush out any problems.

An example session looks like this, for instance, when I copy the text "11/12/2021, 4:35 PM" to the clipboard. This gets converted to "20211112213500000" (notice that the time is UTC), and will be pasted as such when the user pastes:

```
$ tw-timestamp -t US/Eastern
TW date conversion active
11/12/2021, 4:35 PM => 20211112213500000
TW date conversion disabled
```

I hope other people find this useful.

Mohammad

unread,
Nov 16, 2021, 12:31:46 AM11/16/21
to TiddlyWiki
I saw your post here https://talk.tiddlywiki.org/t/tw5-clipboard-hook-convert-dates-into-tiddlywiki-format/1550?u=mohammad
Join us  https://talk.tiddlywiki.org (the new TW forum)

I like your solution and I see potential to do more!
Reply all
Reply to author
Forward
0 new messages