From 42745b94f8e9d74d585f0b1cd600085ed9776ef8 Mon Sep 17 00:00:00 2001 From: Akshay Agarwal Date: Mon, 4 Sep 2017 12:54:28 +0530 Subject: [PATCH] BDateFormat: Properly map day values to ICU day-of-week. Signed-off-by: Adrien Destugues --- headers/os/locale/DateFormat.h | 9 +++++++++ src/kits/locale/DateFormat.cpp | 2 +- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/headers/os/locale/DateFormat.h b/headers/os/locale/DateFormat.h index 2f9aad01eb..cee04e5543 100644 --- a/headers/os/locale/DateFormat.h +++ b/headers/os/locale/DateFormat.h @@ -84,10 +84,19 @@ public: BDate& output); private: + int _ConvertDayNumberToICU(int day) const; + U_ICU_NAMESPACE::DateFormat* _CreateDateFormatter( const BDateFormatStyle style) const; }; +inline int +BDateFormat::_ConvertDayNumberToICU(int day) const +{ + return day == 7 ? 1 : day + 1; +} + + #endif // _B_DATE_FORMAT_H_ diff --git a/src/kits/locale/DateFormat.cpp b/src/kits/locale/DateFormat.cpp index 09fe428656..b70d601915 100644 --- a/src/kits/locale/DateFormat.cpp +++ b/src/kits/locale/DateFormat.cpp @@ -366,7 +366,7 @@ BDateFormat::GetDayName(int day, BString& outName, } BStringByteSink stringConverter(&outName); - names[day].toUTF8(stringConverter); + names[_ConvertDayNumberToICU(day)].toUTF8(stringConverter); delete simpleFormat; return B_OK;