Storing a date in global variable not possible

At least within borders of sanity, storing a date in a global variable and using it later in another formula seems to be impossible. Let's see an example, I have a Komponent which I want to parametrise by a date of an event, say the next alarm, so I'll create a global in the component like so:

time = $si(alarmd)$

For lack of better options the global is of type Text. After I set it, I can see it's real value is 2016-12-21T09:30:00.000+01:00 (yeah, I need to get up early tomorrow :().

Next I wanna use it in another formula, for example to get the hour:

$tf(gv(time), H)$

But this doesn't work, tf does not recognize the format of the variable. The documentation states I can use text as the argument to tf, but in the format '1955y11M12d22h04m00s'. So, even though it would be needlessly complicated (I want to minimise the effort for user of the Komponent, therefore avoid wrapping the $si(alarmd)$ in anything extraneous), I wanted to add a df that would create that required format. But it is not directly possible, because y, M, etc. in the format string get replaced by actual values and I have found no way of escaping (which is probably a bug in itself).

Now I could go and format the string for global variable number by number, but, everybody knows you never go full retard... :D

So what gives, perhaps Date should be another type for global variable? The default tostring and fromstring formats should definitely be unified somehow.

As a side question, how's the performance? Are dates passed as objects internally, should the overhead of serializing and parsing be avoided?

This is kind of a bug, you can solve this issue by using seconds, so set the global to $df(S, si(alarmd))$, doing this way it will convert it to seconds and time functions when a number is passed will convert back to a date.

I've thought of that before, just tried again, doesn't work.

One, I originally actually tested this with df, trying to get the actual hour or minute of the global. That always returns the hour or minute of the current time on error, making debugging that much harder.

Two, I just tested with tf too, to get the hours or minutes countdown till the event. That, for the unix timestamp from the global, seems to return hours or minutes since the epoch (that is, just converts the seconds passed to it).

I also got hit by along the way :(

Ok, so, found three issues here:

1) When you use a date in a text Global the date is converted to text and the text is not a valid "Kustom" date format (which uses something like '1955y11M12d22h04m00s'), this is fixed in next build, it will now work properly on both TF and DF

2) When you pass seconds to DF it should consider those as a date in seconds, its not happening, this is fixed as well

3) When you pass a number to TF that number is considered a "span" so it will not convert it to a date because if you pass, like "200" it has to write something like "3 minutes and 20 seconds", so i have no way at the momento to distinguish a span to a date, but still it will work if the global is a date in Kustom format (so using it the way you used it first time will work)

You can check next beta as soon as up at

Thanks for reporting this :)

Awesome, thanks. Will test the beta later, how long till you release it?

Beta will be released later today (you can get updates in the G+ community)