Hey Evan,
Sorry if Im missing something, but is
now() and date(12,12,12)
not working?
Thanks!
On Sunday, February 4, 2018 at 2:09:26 AM UTC-6, Evan Balster wrote:
>
> Hey, Tony —
>
> The tw_date function should do what you want: It manually turns other
> things into dates, bypassing the normal "interpretation" mechanism. It
> will accept YYYYMMDD dates with each subsequent part being optional. It
> might not work on data that have been interpreted as numbers, which can
> happen with {{transclude}} syntax... To avoid the interpretation, you can
> use the "transclude" or "variable" functions to fetch raw, uninterpreted
> text:
>
> ... tw_date(transclude("tiddler", "field")) ...
>
> Basically the idea is that all automatic conversion can be bypassed or
> done manually.
>
> The "fall-back" behaviors you're describing would best be implemented with
> the "iferror" function, which formula doesn't implement yet. Other than
> that I advise using some string-related functions to figure out what kind
> of data you're dealing with. For example,
> len(trim(x))==0
> tells you if some data is blank (ie, only whitespace or nothing at all).
>
> I might have to investigate the interoperation problems between formula
> and condition.
>
> On Saturday, 3 February 2018 21:35:13 UTC-6, TonyM wrote:
>>
>> Evan,
>>
>> Thanks again for your work.
>>
>> To the point : *So I suppose I am asking, "can the treatment of empty or
>> blank date fields be restored?", or could you "tell me a way to treat such
>> fields to avoid the errors?"*
>>
>> I will return to blank dates shortly.
>>
>> *Date Format*
>> First, removing the trailing "00" or using 000 does indeed let a date
>> display correctly THANKYOU
>> I was erroneously setting dates to one digit short
>> <$action-setfield $field=date-field $value=<<now YYYY0MM0DD0hh0mm0ss000>>
>> $timestamp=no />
>> Previously however this was tolerated. As was a date field with only the
>> date YYYY0MM0DD and other combinations (I have not retested)
>>
>> *Blank dates*
>>
>> This behaviour has changed, I am now getting these errors below when
>> previously use of date fields that had empty or a single space in the date
>> field were tolerated and no result was returned,
>>
>> ComputeError: Cannot auto-convert "" to a date!
>> ComputeError: Cannot auto-convert " " to a date!
>>
>> I was using the existence of a date-field to trigger the display, time
>> stamp or edit of that and other fields
>>
>>
>> - For example if item-started existed it allows you to "select, enter
>> or time stamp the date" item-started
>> - Basically the existence of item-started indicates the tiddler is
>> now under disposition management (regardless of its value or not)
>> - It also provides the ability to optionally provide a item-completed
>> or item-cancelled dates
>> - If I accidentally cancelled the item and cleared the item-cancelled
>> date, to instead set the completed date, I would have a blank cancelled
>> date field.
>>
>> *Why permit " " dates*
>> If I am using the existence of a date field empty or otherwise I use a
>> filter that includes has[fieldname]
>> Of note was that this has[fieldname] filter often seemed only to work
>> when the field existed and was not empty, hence the use of " "
>>
>> On example of where formulas was tolerant of blank and space was in the
>> following, which calculates the number of days between the date-fields
>> value and today.
>>
>> \define daystoday(datefield)
>> (= days( now(), date( {{!!$datefield$}} ) ) =)
>> \end
>>
>>
>> Other examples, It is fine for these to return nothing
>>
>> (= if(tw_date({{!!$datefield$}})=now(),"Today","Not Today") =)
>>
>>
>> \define showtodayrange(datefield1,datefield2)
>> <progress value=<<formula "days( date( {{!!$datefield1$}} ) , now() )">>
>> max=<<formula "days( date( {{!!$datefield1$}} ) , date( {{!!$datefield2$}}
>> ))">>/>
>> \end
>>
>>
>> <$if value=(={{!!$datefield$}}=)>
>> Has value (=date({{!!$datefield$}})=)
>> <$set name=indate value= (=date({{!!$datefield$}})=)>
>> </$if>
>> <$else>
>> No Value (={{!!$datefield$}}=)
>> <$set name=indate value=(=now()=)>
>> </$else>
>>
>> The above also seems broken, using The *Condition* plugin for TiddlyWiki,
>> version 0.1.0 (disabled or not)
>>
>>
>> *So I suppose I am asking, "can the treatment of empty or blank date fields
>> be restored?", or could you "tell me a way to treat such fields to avoid the
>> errors?"*
>>
>>
>> Thanks in advance,
>>
>> Tony
>>
>>
>>
>> On Sunday, February 4, 2018 at 12:54:42 PM UTC+11, Evan Balster wrote:
>>>
>>> Hey all —
>>>
>>> Formula 0.2.2 is out: https://evanbalster.com/tiddlywiki/formulas.html
>>> GitHub: https://github.com/EvanBalster/TiddlyWikiFormula
>>>
>>> Changes:
>>>
>>> - Fixed a bug in the parsing of /* block comments */. // line
>>> comments also work.
>>> - Implemented regular expression literals in the JavaScript style:
>>> /regex/g
>>> - May be used as a Datum
>>> <https://evanbalster.com/tiddlywiki/formulas.html#Datum>
>>> - When converting strings to regex, both JavaScript and
>>> TiddlyWiki styles will be recognized.
>>> - Formula errors now mention LET assignments they lie inside.
>>> - Formulas as Tag Attributes
>>>
>>> <https://evanbalster.com/tiddlywiki/formulas.html#Formulas%20as%20Tag%20Attributes>
>>> are
>>> now facilitated by a mod using the experimental Mod-Loader Plugin
>>> <https://evanbalster.com/tiddlywiki/formulas.html#Mod-Loader%20Plugin>
>>> .
>>>
>>>
>>> *Tony* — I fixed some coercion bugs in 0.2.1 but I'm not sure if those
>>> cover the issues you're reporting.
>>>
>>> The blank definitely won't be treated as a date (what would it default
>>> to, anyway?)
>>>
>>> As for the other one, 2017122410592500 isn't quite a valid TiddlyWiki
>>> date under current semantics.
>>>
>>> *2017 12 24 10 59 25 00*
>>>
>>> The last bit (milliseconds) should be either 3 digits or completely
>>> absent. AFAIK TiddlyWiki dates are never expressed to "centisecond"
>>> precision so this looks out of place to me. I'm strict about what Formula
>>> interprets as a date, because these strings of digits could also be numbers.
>>>
>>>
>>> *BurningTree* — that's a nice looking spreadsheet UI. Consider your
>>> experimentation encouraged!
>>>
>>>
>>> On Friday, 2 February 2018 22:30:02 UTC-6, BurningTreeC wrote:
>>>>
>>>> Hi Evan,
>>>>
>>>> I've found this *handsontable* library and tried making a basic widget
>>>> here: spreadsheet widget
>>>> <http://muritest.tiddlyspot.com/#hot%20spreadsheet:%5B%5Bhot%20spreadsheet%5D%5D%20%5B%5Bthe%20tap%20widget%5D%5D%20%5B%5Bthe%20swipe%20widget%5D%5D%20%5B%5BThe%20widthreveal%20macro%5D%5D%20%5B%5BThe%20wheelreveal%20macro%5D%5D%20%5B%5BPredefined%20layouts%5D%5D%20%5B%5BThis%20is%20a%20preview%20for%20what's%20coming%20with%20v0.1.2%5D%5D%20%5B%5Bmy%20creator%20invented%20the%20touchscreen%5D%5D%20%5B%5BHow%20to%20get%20this%20on%20your%20pc%2C%20laptop%20or%20mobile%20device%5D%5D%20%5B%5B4%20TAP%20to%20Tiddler%20MODAL%20and%20LONG%20PRESS%20to%20open%20sidebar%5D%5D%20%5B%5Bautopopulate%20this%20wiki%20with%20images%5D%5D%20%5B%5BCeci%20n%E2%80%99est%20pas%20une%20pipe.%5D%5D%20%5B%5BI%20am%20Mr.%20Van%20Gogh%5D%5D%20%5B%5BI%20am%20one%20of%20that%20guy's%20paintings%5D%5D%20seamless%20%5B%5Bthe%20best%3A%20you%20can%20drag%2010%20Tiddlers%20at%20once.%5D%5D%20%5B%5Bwatch%20muuri%20in%20different%20colors%5D%5D%20%5B%5Brun%20to%20the%20hills!%5D%5D%20%5B%5BThat's%20the%20way%20I%20like%20it!%5D%5D%20%5B%5Bthe%20best%20louvre%20moment%5D%5D%20%5B%5Bmuuri%20is%20the%20finnish%20word%20for%20wall%5D%5D%20%5B%5Banalogue%20clock%5D%5D%20%5B%5Bmuuri%2C%20muuri%20-%20what's%20this%20muuri-bla%20all%20about%3F%5D%5D%20%5B%5Bsave%20wiki%20button%5D%5D%20%5B%5Ba%20little%20bit%20of%20transparency%5D%5D>
>>>>
>>>> The docs <https://docs.handsontable.com/0.35.1/Core.html> look
>>>> promising and the interface is very nice - the license is MIT
>>>>
>>>> Simon
>>>>
>>>
--
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/97815a95-bf96-4211-b5f1-cee8a0900a27%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.