Skip to content
This repository was archived by the owner on Jan 23, 2023. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -1338,7 +1338,7 @@ internal string InternalGetMonthName(int month, MonthNameStyles style, bool abbr

/// <summary>
/// Retrieve the array which contains the month names in genitive form.
/// If this culture does not use the gentive form, the normal month name is returned.
/// If this culture does not use the genitive form, the normal month name is returned.
/// </summary>
private string[] InternalGetGenitiveMonthNames(bool abbreviated)
{
Expand Down Expand Up @@ -2301,14 +2301,15 @@ internal TokenHashValue[] CreateTokenHashTable()
InsertHash(temp, GetAbbreviatedMonthName(i), TokenType.MonthToken, i);
}


if ((FormatFlags & DateTimeFormatFlags.UseGenitiveMonth) != 0)
{
string [] genitiveMonthNames = InternalGetGenitiveMonthNames(abbreviated: false);
string [] abbreviatedGenitiveMonthNames = InternalGetGenitiveMonthNames(abbreviated: true);

for (int i = 1; i <= 13; i++)
{
string str;
str = InternalGetMonthName(i, MonthNameStyles.Genitive, false);
InsertHash(temp, str, TokenType.MonthToken, i);
InsertHash(temp, genitiveMonthNames[i - 1], TokenType.MonthToken, i);
InsertHash(temp, abbreviatedGenitiveMonthNames[i - 1], TokenType.MonthToken, i);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -344,10 +344,10 @@ internal static int ScanRepeatChar(string pattern, char ch, int index, out int c

////////////////////////////////////////////////////////////////////////////
//
// Add the text that is a date separator but is treated like ignroable symbol.
// Add the text that is a date separator but is treated like ignorable symbol.
// E.g.
// hu-HU has:
// shrot date pattern: yyyy. MM. dd.;yyyy-MM-dd;yy-MM-dd
// short date pattern: yyyy. MM. dd.;yyyy-MM-dd;yy-MM-dd
// long date pattern: yyyy. MMMM d.
// Here, "." is the date separator (derived from short date pattern). However,
// "." also appear at the end of long date pattern. In this case, we just
Expand Down Expand Up @@ -604,7 +604,7 @@ internal static FORMATFLAGS GetFormatFlagUseHebrewCalendar(int calID)
//-----------------------------------------------------------------------------
// EqualStringArrays
// compares two string arrays and return true if all elements of the first
// array equals to all elmentsof the second array.
// array equals to all elements of the second array.
// otherwise it returns false.
//-----------------------------------------------------------------------------

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3303,7 +3303,7 @@ private static bool ParseTimeZoneOffset(ref __DTString str, int len, ref TimeSpa

/*=================================MatchAbbreviatedMonthName==================================
**Action: Parse the abbreviated month name from string starting at str.Index.
**Returns: A value from 1 to 12 for the first month to the twelveth month.
**Returns: A value from 1 to 12 for the first month to the twelfth month.
**Arguments: str: a __DTString. The parsing will start from the
** next character after str.Index.
**Exceptions: FormatException if an abbreviated month name can not be found.
Expand Down Expand Up @@ -3338,6 +3338,19 @@ private static bool MatchAbbreviatedMonthName(ref __DTString str, DateTimeFormat
}
}

// Search genitive form.
if ((dtfi.FormatFlags & DateTimeFormatFlags.UseGenitiveMonth) != 0)
{
int tempResult = str.MatchLongestWords(dtfi.AbbreviatedMonthGenitiveNames, ref maxMatchStrLen);
// We found a longer match in the genitive month name. Use this as the result.
// The result from MatchLongestWords is 0 ~ length of word array.
// So we increment the result by one to become the month value.
if (tempResult >= 0)
{
result = tempResult + 1;
}
}

// Search leap year form.
if ((dtfi.FormatFlags & DateTimeFormatFlags.UseLeapYearMonth) != 0)
{
Expand All @@ -3361,7 +3374,7 @@ private static bool MatchAbbreviatedMonthName(ref __DTString str, DateTimeFormat

/*=================================MatchMonthName==================================
**Action: Parse the month name from string starting at str.Index.
**Returns: A value from 1 to 12 indicating the first month to the twelveth month.
**Returns: A value from 1 to 12 indicating the first month to the twelfth month.
**Arguments: str: a __DTString. The parsing will start from the
** next character after str.Index.
**Exceptions: FormatException if a month name can not be found.
Expand Down