Skip to content

Commit

Permalink
Optimize the time display
Browse files Browse the repository at this point in the history
  • Loading branch information
gdlcf88 committed Dec 18, 2023
1 parent 47deead commit ecf7b0a
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 5 deletions.
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using System;
using System.Globalization;
using System.Threading.Tasks;
using EasyAbp.FileManagement.Files;
using EasyAbp.FileManagement.Web.Pages.FileManagement.Components.FileManagerWidget.ViewModels;
Expand Down Expand Up @@ -34,13 +35,18 @@ public virtual async Task OnGetAsync()
Hash = dto.Hash,
Location = (await _service.GetLocationAsync(dto.Id)).Location,
Creator = dto.Creator?.UserName,
Created = dto.CreationTime,
Created = ToDateTimeString(dto.CreationTime),
LastModifier = dto.LastModifier?.UserName,
Modified = dto.LastModificationTime ?? dto.CreationTime
Modified = ToDateTimeString(dto.LastModificationTime ?? dto.CreationTime)
};
}

protected static string HumanFileSize(long bytes, bool si = false, int dp = 1)
protected virtual string ToDateTimeString(DateTime time)
{
return time.ToString(CultureInfo.CurrentUICulture);
}

protected virtual string HumanFileSize(long bytes, bool si = false, int dp = 1)
{
var thresh = si ? 1000 : 1024;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,13 +38,13 @@ public class FileDetailViewModel

[DisabledInput]
[Display(Name = "CreationTime")]
public DateTime Created { get; set; }
public string Created { get; set; }

[DisabledInput]
[Display(Name = "LastModifier")]
public string LastModifier { get; set; }

[DisabledInput]
[Display(Name = "LastModificationTime")]
public DateTime Modified { get; set; }
public string Modified { get; set; }
}

0 comments on commit ecf7b0a

Please sign in to comment.