mleden wrote:
> I'm using the Exhibit Tabular view.  One of my columns represents an
> elapsed time, so I use:
> date-range(.sindatetime, .srndatetime, 'minute')
> where .sindatetime and .srndatetime come from the JSON "database".
> Works beautifully, except when the elapsed time gets up into the
> hundreds.  At which point, I'd prefer to display something like:
> 2:22
> instead of:
> 142
>
> Thanks in advance for any suggestions!
>   
Mark,

I'd recommend defining a time-format function

<script>
    Exhibit.FunctionUtilities.registerSimpleMappingFunction(
        "time-format",
        function(n) {
           return (n < 100) ? n.toString() : (Math.floor(n / 60) + ":" + 
(n % 60));
        },
        "text"
    );
</script>

And then you can use this expression

    time-format(date-range(.sindatetime, .srndatetime, 'minute'))

David

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"SIMILE Widgets" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/simile-widgets?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to