nci/static/js/app/components/common/duration/index.jade
2015-08-26 20:41:17 +03:00

7 lines
336 B
Plaintext

- var sec = this.props.value / 1000;
- sec = sec >= 1 ? Math.round(sec) : Number(sec.toFixed(2));
- var min = sec >= 60 ? Math.round(sec / 60) : 0;
- var suffix = this.props.withSuffix ? 'in ' : '';
- var ending = min === 1 ? '' : 's';
span(title= sec + ' second' + ending)= suffix + (min ? min + ' minunte' : sec + ' second') + ending