mirror of
https://github.com/overleaf/overleaf.git
synced 2024-12-18 10:32:34 -05:00
15 lines
No EOL
394 B
CoffeeScript
15 lines
No EOL
394 B
CoffeeScript
dateformat = require 'dateformat'
|
|
|
|
module.exports =
|
|
|
|
formatPrice: (priceInCents) ->
|
|
string = priceInCents + ""
|
|
string = "0" + string if string.length == 2
|
|
string = "00" + string if string.length == 1
|
|
string = "000" if string.length == 0
|
|
cents = string.slice(-2)
|
|
dollars = string.slice(0, -2)
|
|
return "$#{dollars}.#{cents}"
|
|
|
|
formatDate: (date) ->
|
|
dateformat date, "dS mmmm yyyy" |