Add "unix" and "unixms" options for date format (#405)

pull/411/head
Andrew Kolos 4 years ago committed by GitHub
parent c4007d4a80
commit ddb4856516
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -37,7 +37,12 @@ namespace DiscordChatExporter.Domain.Exporting
_mediaDownloader = new MediaDownloader(request.OutputMediaDirPath);
}
public string FormatDate(DateTimeOffset date) => date.ToLocalString(Request.DateFormat);
public string FormatDate(DateTimeOffset date) => Request.DateFormat switch
{
"unix" => date.ToUnixTimeSeconds().ToString(),
"unixms" => date.ToUnixTimeMilliseconds().ToString(),
var df => date.ToLocalString(df),
};
public Member? TryGetMember(string id) =>
Members.FirstOrDefault(m => m.Id == id);

Loading…
Cancel
Save