Giter Club home page Giter Club logo

Comments (3)

wahidshalaly avatar wahidshalaly commented on May 12, 2024

I'm thinking to do the following

  1. No need for two methods to show either xxxAgo() or xxxFromNow(). One method with a flag (isFuture) is enough & method should use the proper format from resources.
  2. No need for two methods to show either Singlexxx() or Multiplexxx(int count). Again, one method with input (with default = 1) is enough
  3. Not sure about this yet, but I'm thinking we should also refactor the DefaultFormatter
  4. Split it into two formatters: DateTimeFormatter & TimeSpanFormatter
  5. Shorten names by removing prefixes DateHumaniz_xxx & TimeSpanHumanize_xxx

from humanizer.

MehdiK avatar MehdiK commented on May 12, 2024

Great ideas. This issue is however only about refactoring the implementation of DateTime.Humanize extension: the method is around 70 LoC & IMO a method over 20 lines is already too long!!

You're talking about formatters which is a different issue. So I created #102 and copied your thoughts over. I think refactoring formatters could make this method a bit cleaner but I still think we need to have much fewer if conditions and lines of code in this method.

from humanizer.

MehdiK avatar MehdiK commented on May 12, 2024

Some love has been given to this in #106 but it still could do with more.

from humanizer.

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.