Skip to content

Commit

Permalink
1.1
Browse files Browse the repository at this point in the history
Fixed: long date display in list mode
  • Loading branch information
mchehraz committed May 8, 2015
1 parent 9fa86a5 commit e019c51
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 5 deletions.
10 changes: 10 additions & 0 deletions Atf.Core.Text/DateTimeFormatter.cs
Expand Up @@ -544,6 +544,16 @@ public struct SpecifierInfo {
}
return false;
}
public static string Format(string format, DateTimeFormatInfo dateTimeFormat,
Calendar calendar, DateTime? value) {
SpecifierInfo[] specifiers = GetSpecifiers(format);
DateTimeFormatter formatter = new DateTimeFormatter(dateTimeFormat, value);
StringBuilder sb = new StringBuilder();
foreach (var specifier in specifiers) {
sb.Append(formatter.GetDisplayText(specifier));
}
return sb.ToString();
}
public string GetDisplayText(SpecifierInfo specifier) {
if (specifier.ValueType == ValueType.StringLiteral) {
return specifier.Symbol;
Expand Down
9 changes: 6 additions & 3 deletions Atf.UI/DateTimeSelector/DateTimeSelector.cs
Expand Up @@ -64,7 +64,6 @@ public class DateTimeSelector : DropDownControl {
private RightToLeft calendarRightToLeft = RightToLeft.Inherit;
private static DateTimeFormatInfo persianFormat;
private bool usePersianFormat = false;

#endregion

#region Constructors
Expand Down Expand Up @@ -255,7 +254,9 @@ public class DateTimeSelector : DropDownControl {
DateTime? value = this.Value;
if (value.HasValue) {
string formatString = this.GetFormatString();
return value.Value.ToString(formatString, this.DateTimeFormat);
return DateTimeFormatter.Format(formatString, this.DateTimeFormat, this.DateTimeFormat.Calendar,
this.Value);
// return value.Value.ToString(formatString, this.DateTimeFormat);
}
return string.Empty;
}
Expand Down Expand Up @@ -423,7 +424,9 @@ public class DateTimeSelector : DropDownControl {
DateTime? value = this.Value;
if (value.HasValue) {
if (!string.IsNullOrEmpty(format)) {
return value.Value.ToString(format, this.DateTimeFormat);
// return value.Value.ToString(format, this.DateTimeFormat);
return DateTimeFormatter.Format(format, this.DateTimeFormat, this.DateTimeFormat.Calendar,
this.Value);
}
}
return string.Empty;
Expand Down
4 changes: 2 additions & 2 deletions Properties/AssemblyInfo.cs
Expand Up @@ -33,6 +33,6 @@
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyVersion("1.1.0.0")]
[assembly: AssemblyFileVersion("1.1.0.0")]
[assembly: NeutralResourcesLanguageAttribute("")]

0 comments on commit e019c51

Please sign in to comment.