2023-06-23 21:50:48 +08:00
|
|
|
// © 2022 and later: Unicode, Inc. and others.
|
|
|
|
// License & terms of use: http://www.unicode.org/copyright.html
|
|
|
|
#include "unicode/utypes.h"
|
|
|
|
|
|
|
|
#if !UCONFIG_NO_FORMATTING
|
|
|
|
|
|
|
|
#include "iso8601cal.h"
|
|
|
|
#include "unicode/gregocal.h"
|
|
|
|
|
|
|
|
U_NAMESPACE_BEGIN
|
|
|
|
|
|
|
|
UOBJECT_DEFINE_RTTI_IMPLEMENTATION(ISO8601Calendar)
|
|
|
|
|
|
|
|
ISO8601Calendar::ISO8601Calendar(const Locale& aLocale, UErrorCode& success)
|
|
|
|
: GregorianCalendar(aLocale, success)
|
|
|
|
{
|
2024-04-21 08:44:40 +08:00
|
|
|
UErrorCode tempStatus = U_ZERO_ERROR;
|
|
|
|
int32_t length = aLocale.getKeywordValue("fw", nullptr, 0, tempStatus) +
|
|
|
|
aLocale.getKeywordValue("rg", nullptr, 0, tempStatus);
|
|
|
|
// Do not set first day of week for iso8601 to Monday if we have fw or rg keywords
|
2023-11-02 04:10:15 +08:00
|
|
|
// and let the value set by the Calendar constructor to take care of it.
|
2024-04-21 08:44:40 +08:00
|
|
|
if (U_SUCCESS(tempStatus) && length == 0) {
|
2023-11-02 04:10:15 +08:00
|
|
|
setFirstDayOfWeek(UCAL_MONDAY);
|
|
|
|
}
|
2023-06-23 21:50:48 +08:00
|
|
|
setMinimalDaysInFirstWeek(4);
|
|
|
|
}
|
|
|
|
|
|
|
|
ISO8601Calendar::~ISO8601Calendar()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
ISO8601Calendar* ISO8601Calendar::clone() const
|
|
|
|
{
|
|
|
|
return new ISO8601Calendar(*this);
|
|
|
|
}
|
|
|
|
|
|
|
|
const char *ISO8601Calendar::getType() const
|
|
|
|
{
|
|
|
|
return "iso8601";
|
|
|
|
}
|
|
|
|
|
|
|
|
U_NAMESPACE_END
|
|
|
|
|
|
|
|
#endif
|