Giter Club home page Giter Club logo

Comments (2)

bradgarropy avatar bradgarropy commented on May 28, 2024

Do you have any suggestions for the API? Here is what we currently offer with minutes and seconds.

    const countdown = useCountdown({
        minutes: 1,
        seconds: 30,
        format: "mm:ss",
        onCompleted: () => console.log("onCompleted"),
    })

Maybe instead of supporting two more date fields, I make this API more generic and allow for a duration field instead.

    const countdown = useCountdown({
        duration: 1000,
        format: "mm:ss",
        onCompleted: () => console.log("onCompleted"),
    })

That way it can support literally anything! For your use case you could use date-fns or really just the Date object to calculate the duration between two dates.

While this would be a breaking change, I think it offers more flexibility. Do you have any thoughts @penumatv?

from use-countdown.

bradgarropy avatar bradgarropy commented on May 28, 2024

@penumatv Given that it's been a month since this request and there has been no comment, I'm going to close this issue.

Feel free to reopen if you feel strongly about this!

from use-countdown.

Related Issues (9)

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.