Skip to content

Commit

Permalink
+ Added new Floor and Ceil Lava filters for rounding. Closes SparkDev…
Browse files Browse the repository at this point in the history
  • Loading branch information
arranf committed Aug 21, 2015
1 parent 1fbe039 commit 3da7a30
Showing 1 changed file with 38 additions and 0 deletions.
38 changes: 38 additions & 0 deletions Rock/Lava/RockFilters.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1006,6 +1006,44 @@ public static object DividedBy( object input, object operand, int precision = 2
}
}

public static object Floor( object input)
{
if ( input == null )
{
return input;
}

decimal iInput = -1;

if ( decimal.TryParse( input.ToString(), out iInput ) )
{
return decimal.Floor( iInput );
}
else
{
return "Could not convert input to number to round";
}
}

public static object Ceil( object input )
{
if ( input == null )
{
return input;
}

decimal iInput = -1;

if ( decimal.TryParse( input.ToString(), out iInput ) )
{
return decimal.Ceiling( iInput );
}
else
{
return "Could not convert input to number to round";
}
}

#endregion

#region Attribute Filters
Expand Down

0 comments on commit 3da7a30

Please sign in to comment.