Skip to content

Instantly share code, notes, and snippets.

@johansolve
Last active August 29, 2015 14:27
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save johansolve/1851bbeab7e0c552d429 to your computer and use it in GitHub Desktop.
Save johansolve/1851bbeab7e0c552d429 to your computer and use it in GitHub Desktop.
<?lassoscript
// Durations are not displayed properly in Lasso 8.6, the last digit in seconds is missing.
// This custom tag is used to display durations correctly
define_tag('showduration', -required='input');
!#input -> isa('duration') ? return;
local('output'=string,
'hours'=#input -> second,
'minutes'=#input -> second,
'seconds'=#input -> second);
#hours = #hours / 60 / 60;
#minutes -= #hours * 60 * 60;
#seconds -= #hours * 60 * 60;
#minutes = #minutes / 60;
#seconds -= #minutes * 60;
#hours -> setformat(-padding=2, -padchar='0');
#minutes -> setformat(-padding=2, -padchar='0');
#seconds -> setformat(-padding=2, -padchar='0');
#output += #hours;
#output += ':';
#output += #minutes;
#output += ':';
#output += #seconds;
return(#output);
/define_tag;
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment