Comments (3)
I'm thinking to do the following
- 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.
- No need for two methods to show either Singlexxx() or Multiplexxx(int count). Again, one method with input (with default = 1) is enough
- Not sure about this yet, but I'm thinking we should also refactor the DefaultFormatter
- Split it into two formatters: DateTimeFormatter & TimeSpanFormatter
- Shorten names by removing prefixes DateHumaniz_xxx & TimeSpanHumanize_xxx
from humanizer.
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.
Some love has been given to this in #106 but it still could do with more.
from humanizer.
Related Issues (20)
- Titlize removes decimal point HOT 3
- TimeUnit.ToSymbol() don't take culture into account HOT 2
- Request: Collection.Humanize(Culture culture) instead of defaulting
- Missing DateHumanize_Never for Resources.zh-CN.resx
- Humanize size, e.g. 1280x720 => "HD", 850x480 => "SD" HOT 1
- Pascalize a kebab-cased string returns a Kebab-Cased string. HOT 2
- string.Humanize(LetterCasing.Title) Has Different Behavior Than To.TitleCase Extension (Symbols)
- error NU1202: Package Humanizer.Core.ar 2.14.1 is not compatible wit h net7.0 (.NETCoreApp,Version=v7.0). Package Humanizer.Core.ar 2.14.1 does not support any target frameworks. HOT 5
- Humanize Enum key and DescriptionAttribute HOT 1
- ToMetric with decimal places?
- Dehumanize() doesn't get rid of forward slash in input string.
- Add time of day-based greetings
- Is there a way to ignore & symbol HOT 1
- Pluralize with LetterCasing.AllCaps returns plural with lower case "s" HOT 1
- Humanizing dates in time zones other than system and UTC HOT 2
- decimal to percentage string HOT 3
- Localisation "ToWords" pt-PT for European portuguese no longer available HOT 1
- [Bug] `Camelize()` does not respect acronyms
- Is this library still maintained? HOT 29
- How do I specify a culture? HOT 5
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from humanizer.