Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TimeSpan Humanize Arabic issue #950

Closed
Saad-Alothman opened this issue Jun 13, 2020 · 1 comment · Fixed by #952
Closed

TimeSpan Humanize Arabic issue #950

Saad-Alothman opened this issue Jun 13, 2020 · 1 comment · Fixed by #952

Comments

@Saad-Alothman
Copy link

Saad-Alothman commented Jun 13, 2020

Im trying to acheive the follwoing:
display the duartion of a teacher's contract based on start and end date,

            DateTime contractStartDate = DateTime.Now.Date;
            DateTime contractEndDate = DateTime.Now.Date.AddYears(1);
            TimeSpan contractTimeSpan = contractEndDate - contractStartDate;
            //This result produces expected in english : 11 months, 30 days
            string resultEnglish = contractTimeSpan.Humanize(3, maxUnit: Humanizer.Localisation.TimeUnit.Year);
            //this is wrong: eleven أشهر
            string resultArabic = contractTimeSpan.Humanize(1, culture: Language.CULTURE_ARABIC, maxUnit: Humanizer.Localisation.TimeUnit.Year,toWords:true);
            //this is wrong: eleven أشهر, thirty يوم
            string resultArabicPrecision2 = contractTimeSpan.Humanize(2, culture: Language.CULTURE_ARABIC, maxUnit: Humanizer.Localisation.TimeUnit.Year, toWords: true);

is that an issue or am i missing something here?

@Xlient
Copy link
Contributor

Xlient commented Jun 25, 2020

It looks like an issue to me, I am producing the same results ...but not just in Arabic its also in other languages.

DateTime contractStartDate = DateTime.Now.Date;
            DateTime contractEndDate = DateTime.Now.Date.AddYears(1);
            TimeSpan contractTimeSpan = contractEndDate - contractStartDate;
//eleven months
            string resultEnglish = contractTimeSpan.Humanize(1, maxUnit: Humanizer.Localisation.TimeUnit.Year, toWords: true);

// "eleven أشهر"
            string resultArabic = contractTimeSpan.Humanize(1, culture: new CultureInfo("ar"), maxUnit: Humanizer.Localisation.TimeUnit.Year, toWords: true);

 //eleven mois
            string resultFrench = contractTimeSpan.Humanize(1, culture: new CultureInfo("fr"), maxUnit: Humanizer.Localisation.TimeUnit.Year, toWords: true);

// eleven meses
            string resultSpanish = contractTimeSpan.Humanize(1, culture: new CultureInfo("es"), maxUnit: Humanizer.Localisation.TimeUnit.Year, toWords: true);

//"eleven месяцев"
            string resultrussian = contractTimeSpan.Humanize(1, culture: new CultureInfo("ru"), maxUnit: Humanizer.Localisation.TimeUnit.Year, toWords: true);

I would like to contribute to this issue ~

Xlient added a commit to Xlient/Humanizer that referenced this issue Jun 25, 2020
clairernovotny added a commit that referenced this issue Aug 31, 2020
Fix #950  Timespan.Humanize( toWords: true) incorrect culture
jvanrhyn pushed a commit to jvanrhyn/Humanizer that referenced this issue Sep 10, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants