Git Product home page Git Product logo

Comments (4)

jimvaneijk avatar jimvaneijk commented on June 30, 2024 5

@alvipeo

Add {trim: false} to your format like so:

const s = duration.format("hh:mm:ss", {trim: false});

see (#68)

from moment-duration-format.

juicycool92 avatar juicycool92 commented on June 30, 2024 2

그게 내가 찾고있는거야. 하지만 기본 설정에 대해 {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

from moment-duration-format.

floriandotorg avatar floriandotorg commented on June 30, 2024

+1

from moment-duration-format.

juicycool92 avatar juicycool92 commented on June 30, 2024

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 :<

from moment-duration-format.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.