|
|
@ -33,6 +33,8 @@ namespace Microsoft.Windows.Controls |
|
|
string designator = ""; |
|
|
string designator = ""; |
|
|
string[] dateTimeSeparators = new string[] { ",", " ", "-", ".", "/", cultureInfo.DateTimeFormat.DateSeparator, cultureInfo.DateTimeFormat.TimeSeparator }; |
|
|
string[] dateTimeSeparators = new string[] { ",", " ", "-", ".", "/", cultureInfo.DateTimeFormat.DateSeparator, cultureInfo.DateTimeFormat.TimeSeparator }; |
|
|
|
|
|
|
|
|
|
|
|
ResolveSortableDateTimeString(ref dateTime, ref format, cultureInfo); |
|
|
|
|
|
|
|
|
var dateTimeParts = dateTime.Split(dateTimeSeparators, StringSplitOptions.RemoveEmptyEntries).ToList(); |
|
|
var dateTimeParts = dateTime.Split(dateTimeSeparators, StringSplitOptions.RemoveEmptyEntries).ToList(); |
|
|
var formats = format.Split(dateTimeSeparators, StringSplitOptions.RemoveEmptyEntries).ToList(); |
|
|
var formats = format.Split(dateTimeSeparators, StringSplitOptions.RemoveEmptyEntries).ToList(); |
|
|
|
|
|
|
|
|
@ -73,6 +75,20 @@ namespace Microsoft.Windows.Controls |
|
|
return String.Format("{0} {1} {2}", date, time, designator); |
|
|
return String.Format("{0} {1} {2}", date, time, designator); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private static void ResolveSortableDateTimeString(ref string dateTime, ref string format, CultureInfo cultureInfo) |
|
|
|
|
|
{ |
|
|
|
|
|
if (format == cultureInfo.DateTimeFormat.SortableDateTimePattern) |
|
|
|
|
|
{ |
|
|
|
|
|
format = format.Replace("'", "").Replace("T", " "); |
|
|
|
|
|
dateTime = dateTime.Replace("'", "").Replace("T", " "); |
|
|
|
|
|
} |
|
|
|
|
|
else if (format == cultureInfo.DateTimeFormat.UniversalSortableDateTimePattern) |
|
|
|
|
|
{ |
|
|
|
|
|
format = format.Replace("'", "").Replace("Z", ""); |
|
|
|
|
|
dateTime = dateTime.Replace("'", "").Replace("Z", ""); |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
private static Dictionary<string, string> GetDateParts(DateTime currentDate, CultureInfo cultureInfo) |
|
|
private static Dictionary<string, string> GetDateParts(DateTime currentDate, CultureInfo cultureInfo) |
|
|
{ |
|
|
{ |
|
|
Dictionary<string, string> dateParts = new Dictionary<string, string>(); |
|
|
Dictionary<string, string> dateParts = new Dictionary<string, string>(); |
|
|
|