Hi Arkady As far as I can tell, you have correctly set up the tiddlerfield object to describe the new “scheduled” field.
The problem is that your “New Tiddler” has a “scheduled” field that is a string; the tiddlerfield object causes the core to expect the field to be a date, hence the crash when it turns out to be a string. I suspect that the problem is caused by the way that you are assigning a value to the field, which is just to set it to a string value. You may be able to work around it by ensuring that the field is set to a JS date object. Having said that, the core function $tw.utils.stringifyDate() could be modified to automatically convert strings to dates, which might work around the problem. Best wishes Jeremy > On 10 Mar 2016, at 02:44, Arkady Grudzinsky <[email protected]> wrote: > > Jeremy, > > I see, most of the features I asked for back in 2013 in this thread are > implemented now (e.g. date comparison with "days[]" filter). I'm returning > back to the idea of tracking my projects in TW5. I created a custom date > field called "scheduled" using the methodology you described below. The > "scheduled" field seems to get a correct type now. However, when I try to > use this field in widgets, I get an error message "Uncaught TypeError: > value.getUTCFullYear is not a function" > > I have a feeling that something is missing in my date field specification, > but cannot figure out what. From what I understand, getUTCFullYear() is a > standard JavaScript function, but it seems that for it to work, "value" needs > to be of the date type, and the way the field is defined, JavaScript does not > recognize the field as a date. > > See the attached latest empty.html TW5 file. The "scheduled" field is > defined in [[$:/plugins/tf/scheduled.js]], and the error is caused by the > [[New Tiddler]] which has a "scheduled" field set to 20130301000000000 and is > trying to show it using > <$view field="scheduled"/>. You will get the error if you try to open the > [[New Tiddler]]. > > Do you know why it crashes? Is there a better way to create a custom date > field now? I noticed that the <<timeline>> macro allows "dateField" > parameter. I get the same error when I try to use my "scheduled" field with > it. > > > On Tuesday, October 29, 2013 at 1:57:05 AM UTC-7, Jeremy Ruston wrote: > The tiddlerfields that are defined in the core are not full modules because > they are needed before the tiddler loading mechanism is fully installed. That > call to $tw.modules.define() directly defines the module exports. > > For a normal module, you should use something like this: > > /*\ > title: $:/plugins/arkadygrudzinsky/startfield.js > type: application/javascript > module-type: tiddlerfield > > Implements the start field as a date > > \*/ > (function(){ > > /*jslint node: true, browser: true */ > /*global $tw: false */ > "use strict"; > > exports.name <http://exports.name/> = "start"; > exports.parse = $tw.utils.parseDate; > exports.stringify = $tw.utils.stringifyDate; > > })(); > > Let me know how you get on, > > Best wishes > > Jeremy > > > > On Tue, Oct 29, 2013 at 1:19 AM, Arkady Grudzinsky <agrud...@ <>gmail.com > <http://gmail.com/>> wrote: > Jeremy, > > > Are tiddler fields always treated as text or is it possible to set a field > type (e.g. date, integer, etc.). > Tiddler fields are strings by default, but can be typed through the use of > "tiddlerfield" modules. The core tiddlerfields are in boot.js: > > https://github.com/Jermolene/TiddlyWiki5/blob/master/boot/boot.js#L713 > <https://github.com/Jermolene/TiddlyWiki5/blob/master/boot/boot.js#L713> > A newbie question. > > I was able to chage my custom "start" field type to "date" by adding this to > boot.js: > > $tw.modules.define("$:/boot/modules/tiddlerfields/start","tiddlerfield",{ > > name: "start", > parse: $tw.utils.parseDate, > stringify: $tw.utils.stringifyDate > }); > > > > After that I was able to use > > I guess, it's not a good idea to mess with boot.js. So, I tried to create a > tiddler called "$:/boot/modules/tiddlerfields/start" and set its type to > "application/javascript", "module-type: tiddlerfield". But I could not get > it to register. It seems, I'm missing how to get the .js tiddler code > registered as a module. > > I also tried naming the tiddler "$:/core/modules/tiddlerfields/start" > thinking that boot somehow loads all "$:/core/modules" tiddlers, but it did > not work. What am I missing? > > Thanks. > > -- > Arkady > > > On Saturday, October 26, 2013 7:12:39 AM UTC-7, Jeremy Ruston wrote: > Hi Arkady > > Thanks for the encouragement, and the detailed feedback, much appreciated. > > I'm currently using mGSD to manage my tasks. Recently tried TW5. I think, > it's awesome. Wanted to thank Jeremy for Tiddlywiki. <$list> and > <$checkbox> widgets available at TW5 are very handy to create task lists by > project/context/contact. The TW5 ability to manipulate and customize tiddler > fields is a great addition. I was able to create <$list> of tasks sorted by > custom fields such as "start", "due", or "priority". I also love the > minimalism of the interface. > > Great, I'm glad that the checkbox and list widgets are understandable. > > Couple of questions about TW5 features for which I could not find > documentation. I'm thinking of implementing recurring tasks in TW5. I > envision using tags "recurring" and "weekly"/"daily"/"monthly", etc. and use > fields such as "start", "modified", etc. So, my questions are: > Is it possible to set <$list> filter to select tiddlers using comparisons? > E.g. select tiddlers with "start" date before "now" to make tasks appear on > the list at certain date/time? Perhaps, it's possible to do it in a similar > fashion as mGSD handles ticklers, but I thought, <$list> widget might offer a > much simpler way. > There's no comparison operators yet, but the plan is to have them as filter > operator modules. See the "has" operator as an example: > > https://github.com/Jermolene/TiddlyWiki5/blob/master/core/modules/filters/has.js > > <https://github.com/Jermolene/TiddlyWiki5/blob/master/core/modules/filters/has.js> > Is it possible to set <$list> filter to select tiddlers with tags/titles > matching a regular expression? > Not at the moment, but it's a good idea. > Is it possible to have <$checkbox> widget do more than assign a tag to a > tiddler? E.g. Can it increment the "start" date field by 7 days? > > Not yet. TW5 doesn't yet really have the general concept of programmable > actions, but something along those lines is going to be useful. For the > moment, I'd expect a GxD implementation to have it's own extended checkbox > widget. > Are tiddler fields always treated as text or is it possible to set a field > type (e.g. date, integer, etc.). > Tiddler fields are strings by default, but can be typed through the use of > "tiddlerfield" modules. The core tiddlerfields are in boot.js: > > https://github.com/Jermolene/TiddlyWiki5/blob/master/boot/boot.js#L713 > <https://github.com/Jermolene/TiddlyWiki5/blob/master/boot/boot.js#L713> > Is it possible to create contextual tiddler templates? E.g. > when a tiddler is tagged as "project", the tiddler view would automatically > show lists of tasks or > when a tiddler is tagged as "context", the tiddler view would automatically > show a list of tasks orgainzed differently, etc. > (similar behavior as in mGSD, only I would expect a more transparent and > customizeable syntax with <$list> and <$view>. In mGSD, it's done through > macros which are hard to find and difficult to customize.) > You can almost do that in a basic form with the reveal widget. Basically each > type of view that you need would be a separate ViewTemplate segment (i.e. a > tiddler tagged $:/tags/ViewTemplate). You'd wrap it in a reveal widget that > would selectively display the template depending on the tags on the current > tiddler. The reveal widget doesn't yet allow for testing tags, though. > > Would be nice to have an easy way to create a tiddler with a certain template > (e.g. create buttons with custom functionality). I have a feeling that > buttons are already implemented, but not documented. Is it true? > There is a button widget that's used for the new tiddler button: > > <$button message="tw-new-tiddler" > class="btn-invisible">{{$:/core/images/new-button}}</$button> > > The plan is to extend the tw-new-tiddler message so that the title of a > template tiddler can be provided. > Finally, I may be reinventing the wheel. Is there a GTD implementation based > on TW5? Even if there is, I, probably, would want to customize a few things. > So, I still would like to know the answers. > > No, there's no GTD implementations that I'm aware of. > > Do be aware that TW5 will undergo quite significant changes in the next > couple of days as I complete a round of refactoring that I've been doing. > With the new changes the generated HTML is much cleaner, and the individual > widgets have been rationalised and simplified: > > https://github.com/Jermolene/TiddlyWiki5/pull/178 > <https://github.com/Jermolene/TiddlyWiki5/pull/178> > > Thanks again to all Tidlywiki developers. It's an awesome tool for many > things. I have not seen so much functionality packed in ~600K of code. > > Thank you, much appreciated. Eventually we'll minify the TW5 core by default, > which should reduce the footprint somewhat! > > Best wishes > > Jeremy > > > > > > > -- > You received this message because you are subscribed to the Google Groups > "TiddlyWiki" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to tiddlywiki+...@ <>googlegroups. <http://googlegroups.com/>com > <http://googlegroups.com/>. > To post to this group, send email to tiddl...@ <>googlegroups.com > <http://googlegroups.com/>. > > Visit this group at http://groups.google.com/group/tiddlywiki > <http://groups.google.com/group/tiddlywiki>. > For more options, visit https://groups.google.com/groups/opt_out > <https://groups.google.com/groups/opt_out>. > > > > -- > Jeremy Ruston > mailto:jeremy...@ <>gmail.com <http://gmail.com/> > > > > -- > Jeremy Ruston > mailto:jeremy...@ <>gmail.com <http://gmail.com/> > <empty.html> -- You received this message because you are subscribed to the Google Groups "TiddlyWiki" 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 https://groups.google.com/group/tiddlywiki. To view this discussion on the web visit https://groups.google.com/d/msgid/tiddlywiki/7A0A02C0-91C3-42FE-805D-9E82857CAC94%40gmail.com. For more options, visit https://groups.google.com/d/optout.

