Skip to content

Commit

Permalink
Update readme with date to words
Browse files Browse the repository at this point in the history
Changed the readme to add date-to-words documentation.
  • Loading branch information
CiscoAstrum committed Jun 9, 2022
1 parent 7fd79ad commit 6e0aa69
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions readme.md
Expand Up @@ -38,6 +38,7 @@ Humanizer meets all your .NET needs for manipulating and displaying strings, enu
- [Number to Numbers](#number-to-numbers)
- [Number to words](#number-to-words)
- [Number to ordinal words](#number-to-ordinal-words)
- [Date to words](#date-to-words)
- [DateTime to ordinal words](#date-time-to-ordinal-words)
- [TimeOnly to Clock Notation](#time-only-to-clock-notation)
- [Roman numerals](#roman-numerals)
Expand Down Expand Up @@ -884,6 +885,23 @@ Passing `wordForm` argument in when it is not applicable will not make any diffe
43.ToOrdinalWords(GrammaticalGender.Masculine, WordForm.Abbreviation, new CultureInfo("en")) => "forty-third"
```

### <a id="date-to-words">Date to words</a>
This is kind of an extension of ToWords and Ordinalize
```C#
// for Spanish locale
new DateTime(2022, 1, 1).ToOrdinalWords() => "uno de enero de dos mil veintidós"
new DateOnly(2020, 6, 10).ToOrdinalWords() => "diez de junio de dos mil veinte"
new DateOnly(1999, 12, 31).ToOrdinalWords() => "treinta y uno de diciembre de mil novecientos noventa y nueve"
// for English UK locale
new DateTime(2022, 1, 1).ToOrdinalWords() => "the first of January two thousand and twenty-two"
// for English US locale
new DateTime(2022, 1, 1).ToOrdinalWords() => "January first, two thousand and twenty-two"
```

The ToWords method of `DateTime` or `DateOnly` also supports grammatical case.
You can pass a second argument to `ToWords` to specify the case of the output.
The possible values are `GrammaticalCase.Nominative`, `GrammaticalCase.Genitive`, `GrammaticalCase.Dative`, `GrammaticalCase.Accusative`, `GrammaticalCase.Instrumental` and `GrammaticalGender.Prepositional`

### <a id="date-time-to-ordinal-words">DateTime to ordinal words</a>
This is kind of an extension of Ordinalize
```C#
Expand Down

0 comments on commit 6e0aa69

Please sign in to comment.