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 UOBJECT_DEFINE_RTTI_IMPLEMENTATION(ISO8601Calendar)12UOBJECT_DEFINE_RTTI_IMPLEMENTATION(ISO8601Calendar) 13 14 ISO8601Calendar::ISO8601Calendar(const Locale& aLocale, UErrorCode& success) 15 : GregorianCalendar(aLocale, success) 16 { 17 UErrorCode fwStatus = U_ZERO_ERROR; 18 int32_t fwLength = aLocale.getKeywordValue("fw", nullptr, 0, fwStatus); 19 // Do not set first day of week for iso8601 to Monday if we have fw keyword 20 // and let the value set by the Calendar constructor to take care of it. 21 if (U_SUCCESS(fwStatus) && fwLength == 0) { 22 setFirstDayOfWeek(UCAL_MONDAY); 23 } 24 setMinimalDaysInFirstWeek(4); 25 } 26 ~ISO8601Calendar()27ISO8601Calendar::~ISO8601Calendar() 28 { 29 } 30 clone() const31ISO8601Calendar* ISO8601Calendar::clone() const 32 { 33 return new ISO8601Calendar(*this); 34 } 35 getType() const36const char *ISO8601Calendar::getType() const 37 { 38 return "iso8601"; 39 } 40 41 U_NAMESPACE_END 42 43 #endif 44