/src/icu/icu4c/source/i18n/iso8601cal.cpp
Line | Count | Source |
1 | | // © 2022 and later: Unicode, Inc. and others. |
2 | | // License & terms of use: http://www.unicode.org/copyright.html |
3 | | #include "unicode/utypes.h" |
4 | | |
5 | | #if !UCONFIG_NO_FORMATTING |
6 | | |
7 | | #include "iso8601cal.h" |
8 | | #include "unicode/gregocal.h" |
9 | | |
10 | | U_NAMESPACE_BEGIN |
11 | | |
12 | | UOBJECT_DEFINE_RTTI_IMPLEMENTATION(ISO8601Calendar) |
13 | | |
14 | | ISO8601Calendar::ISO8601Calendar(const Locale& aLocale, UErrorCode& success) |
15 | 139 | : GregorianCalendar(aLocale, success) |
16 | 139 | { |
17 | 139 | UErrorCode tempStatus = U_ZERO_ERROR; |
18 | 139 | int32_t length = aLocale.getKeywordValue("fw", nullptr, 0, tempStatus) + |
19 | 139 | aLocale.getKeywordValue("rg", nullptr, 0, tempStatus); |
20 | | // Do not set first day of week for iso8601 to Monday if we have fw or rg keywords |
21 | | // and let the value set by the Calendar constructor to take care of it. |
22 | 139 | if (U_SUCCESS(tempStatus) && length == 0) { |
23 | 139 | setFirstDayOfWeek(UCAL_MONDAY); |
24 | 139 | } |
25 | 139 | setMinimalDaysInFirstWeek(4); |
26 | 139 | } |
27 | | |
28 | | ISO8601Calendar::~ISO8601Calendar() |
29 | 100k | { |
30 | 100k | } |
31 | | |
32 | | ISO8601Calendar* ISO8601Calendar::clone() const |
33 | 100k | { |
34 | 100k | return new ISO8601Calendar(*this); |
35 | 100k | } |
36 | | |
37 | | const char *ISO8601Calendar::getType() const |
38 | 0 | { |
39 | 0 | return "iso8601"; |
40 | 0 | } |
41 | | |
42 | | U_NAMESPACE_END |
43 | | |
44 | | #endif |