From b85f9f9a122cca724645fb0c499df7ba33d420e1 Mon Sep 17 00:00:00 2001
From: Akshay Agarwal <agarwal.akshay.akshay8@gmail.com>
Date: Mon, 4 Sep 2017 12:54:28 +0530
Subject: [PATCH] BDateFormat: Properly map day values to ICU day-of-week.
---
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 2f9aad0..cee04e5 100644
a
|
b
|
public:
|
84 | 84 | BDate& output); |
85 | 85 | |
86 | 86 | private: |
| 87 | int _ConvertDayNumberToICU(int day) const; |
| 88 | |
87 | 89 | U_ICU_NAMESPACE::DateFormat* _CreateDateFormatter( |
88 | 90 | const BDateFormatStyle style) const; |
89 | 91 | |
90 | 92 | }; |
91 | 93 | |
92 | 94 | |
| 95 | inline int |
| 96 | BDateFormat::_ConvertDayNumberToICU(int day) const |
| 97 | { |
| 98 | return day == 7 ? 1 : day + 1; |
| 99 | } |
| 100 | |
| 101 | |
93 | 102 | #endif // _B_DATE_FORMAT_H_ |
diff --git a/src/kits/locale/DateFormat.cpp b/src/kits/locale/DateFormat.cpp
index 09fe428..b70d601 100644
a
|
b
|
BDateFormat::GetDayName(int day, BString& outName,
|
366 | 366 | } |
367 | 367 | |
368 | 368 | BStringByteSink stringConverter(&outName); |
369 | | names[day].toUTF8(stringConverter); |
| 369 | names[_ConvertDayNumberToICU(day)].toUTF8(stringConverter); |
370 | 370 | |
371 | 371 | delete simpleFormat; |
372 | 372 | return B_OK; |