TiddlyWiki / TiddlyWiki5

A self-contained JavaScript wiki for the browser, Node.js, AWS Lambda etc.
https://tiddlywiki.com/
Other
7.98k stars 1.18k forks source link

Special field handling #3779

Closed AnthonyMuscio closed 4 years ago

AnthonyMuscio commented 5 years ago

Folks,

The Transclusions

{{!!modified}}
{{!!created}}

Return formatted dates, taking into account UTC and the time zone. This is not standard transclusion behaviour.

Can we please document the method used so designers could do the same for other fields, especially date fields. How to defeat this and return the real value would also be helpful.

This could be simply a matter of documentation or perhaps we need to open this up with a hack ability improvement.

Any tips here, so I can craft a better request would be helpful, thanks Tony

AnthonyMuscio commented 5 years ago

Relevant Discussion only for breakdown in date fields

Broken Doco https://tiddlywiki.com/#TiddlerFields all references are broken or non existant

Jermolene commented 5 years ago

Hi @AnthonyMuscio I'm on mobile and so can't easily find the past discussions on this.

The boot kernel establishes some special behaviour for a handful of fields: modified, created, list, tags and color. For the first four, we customise how the field is converted between the serialised external format and the internal (JS) format. For the colour field we customise how the edit widget renders the field so that it is displayed as a colour picker.

This behaviour was carried over from TWC but long ago we realised that it was causing more harm than good. It's too late to change now.

AnthonyMuscio commented 5 years ago

Ok, I get your point, Knowing how it is currently done is not of much value.

However It sounds like it may be causing a barrier to better field handling.

Then may a Propose a path, for users to achieve something similar? I apologise in advance for the length of this reply, deal with it in your own time. It is based on lots of prior design and analysis.

I have done a lot of work on the concept of a field definition tiddler. I am proposing a methodology with peer review and necessarily a plugin to start, however I may need some help and I certainly would need your conditional approval, as we need to set a few standards. All of which are backward compatible because this is an add-on to current functionality only.

Such a field definition tiddler can specify the following for each custom field;

We should also design this to operate appropriately so we can edit the fields in what appears to be the current tiddler even although it is not, much of this can also be presented in the Edit View Field, edit lines, including a link to the field definition tiddler. eg $:/fields/fieldname. This is possible, it is just its too complex for even the best to do, its not easy. When by comparison creating a Field in a word Document or spreadsheet is relatively easy.

Users will be give some help creating a Field definition tiddler and some usable tiddler fieldnames and default values however they will need to reference the field definition tiddler and fields within it to build solutions that reference such fields in their tiddlers, lists and forms.

At most some hackability options, in the core would help achieve this, but will not be necessary, only desirable.

yours Sincerely Tony

pmario commented 5 years ago

Just some notes:

I'd like to have a DatePicker. The problem is browser support: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input/date#Browser_compatibility

pmario commented 5 years ago

@AnthonyMuscio

AnthonyMuscio commented 5 years ago

Thanks for the details Mario,

I think I will abandon trying to use the existing mechanism in favour of a new one, unless it could be opened to user hackability.

I'd like to have a DatePicker. The problem is browser support: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input/date#Browser_compatibility

I am using the datepicker plugin from https://github.com/kixam/TW5-datepicker

I have not tested it on various browsers except FF and Chrome. It is easy to incorporate it in my field definition tiddlers. And select while in the View template.

Regards Tony

pmario commented 5 years ago

I am using the datepicker plugin from https://github.com/kixam/TW5-datepicker

Way too much overhead for me!

pmario commented 5 years ago

As Jeremy pointed out,

This behaviour was carried over from TWC but long ago we realised that it was causing more harm than good. It's too late to change now.

"Internal", "hardcoded" magic always causes problems, because the elements affected are limited. Users need generic ways to solve some problems, with their own custom fields. ...

So I think your approach with some configuration tiddlers is the right one.

00SS commented 5 years ago

This comment is probably useless, but I will make it anyway.

Just like we can change some normal behaviour by setting a core variable to yes or no, such as:

<$set name="tv-wikilinks" value="no">
HelloThere,
[[HelloThere]],
<$link to="HelloThere">is //this// a link?</$link>
</$set>

What if there was a tv-utc-date variable, so that:

<$set name="tv-utc-date" value="no">
{{!!modified}}
{{!!created}}
</$set>

Would give Tony's required result?

pmario commented 5 years ago

This comment is probably useless, but I will make it anyway. ...

No "on-topic" comments are useless. ... How should we know, what you think? thx!

AnthonyMuscio commented 5 years ago

I am using the datepicker plugin from https://github.com/kixam/TW5-datepicker

Way too much overhead for me!

A Widget equivalent of

<input type="date" name="bday" max="1979-12-31">

Good enough for me? to set fieldname, text reference or variable.

AnthonyMuscio commented 4 years ago

Closing and will open a more targeted issue