Skip to content

Instantly share code, notes, and snippets.

@imRohan
Created October 26, 2016 14:22
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 imRohan/c09e0e5d227cf1eed9c48daa39aeb39e to your computer and use it in GitHub Desktop.
Save imRohan/c09e0e5d227cf1eed9c48daa39aeb39e to your computer and use it in GitHub Desktop.
A simple function which take a value, and rounds it down to the nearest 0.5
formatAllotmentValue = (value) ->
_value = parseFloat(value)
if parseFloat((_value%(Math.floor(_value))).toFixed(1)) >= 0.5
return Math.floor(_value) + 0.5
else
return Math.floor(_value)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment