obolus/www/components/humanize.js

15 lines
390 B
JavaScript
Raw Normal View History

2019-05-22 18:34:58 +00:00
import React from 'react'
import { Duration } from 'uhrwerk'
export const timePassedSinceTimestamp = since => new Duration(Date.now() - since, 'milliseconds').humanize() + ' ago'
export const formatPrice = price => {
const [int, float] = price.toFixed(2).split('.')
return <span className={'mr-1'}>
<b>{int}
<small>,{float}</small>
</b>
</span>
}