Open alvipeo opened 4 years ago
+1
@alvipeo
Add {trim: false}
to your format like so:
const s = duration.format("hh:mm:ss", {trim: false});
see (https://github.com/jsmreese/moment-duration-format/issues/68)
thats what im looking for. but is there any way to {trim: false} for default settings? all my codes are expect with no trim, so i have to give a setting everytime i formatting :<
그게 내가 찾고있는거야. 하지만 기본 설정에 대해 {trim: false}하는 방법이 있습니까? 내 모든 코드는 트리밍 없이 예상되므로 포맷할 때마다 설정을 지정해야 합니다.<
ohh nvm i figured out. if someone having trouble like me : try this
import moment from 'moment';
import 'moment-duration-format';
moment.duration.fn.format.defaults.trim = false;
console.log( moment.duration( 600, 'seconds' ).format( 'HH:mm:ss' ) ) // 00:30:00
console.log( moment.duration( 600, 'seconds' ).format( 'HH:mm:ss', { trim: false } ) ) // 00:30:00
I was expecting it to be "00:08:00"! Is this a bug? If not, how can I get hours part in the string?
v.2.3.2