DiscordChatExporter
DiscordChatExporter copied to clipboard
How to configure rfc3339/iso8601 date format in HTML output?
Version
v2.41
Flavor
CLI (Command-Line Interface)
Platform
linux
Export format
HTML
Steps to reproduce
With --date
replacing --locale
, I don't see any way to configure iso8601 date format for html output. Do I miss how to configure it? Otherwise I'd be really happy if I could set a "international" iso8601 locale.
Details
- Expected behavior: dateformat is "YYYY-MM-DD HH:SSZ" (rfc3339/iso8601) formatted.
- Got behavior: date format is in american format (mm/dd/yyyy ...)
Checklist
- [X] I have looked through existing issues to make sure that this bug has not been reported before
- [X] I have provided a descriptive title for this issue
- [X] I have made sure that that this bug is reproducible on the latest version of the application
- [X] I have provided all the information needed to reproduce this bug as efficiently as possible
- [ ] I have sponsored this project
Yes, --dateformat
was removed as part of #879. The main reason for that was that the application used a lot more than just one format, but only one of them was somewhat configurable.
The locale option generally offers more flexibility, as you can achieve the same behavior that the Discord app provides via the Language tab in settings. Unfortunately, that also means setting a non-locale-specific date format (such as ISO8601) is no longer possible.
Note that if you hover over the date, the tooltip will show the date in a locale-specific full date-time format, which is mostly unambiguous (unlike mm/dd/yyyy
). Otherwise, if you really need deterministic timestamp formats, it's recommended to use the JSON export instead. The HTML export is intended to mimic the look and behavior of the Discord app.
Thanks for your fast reply :). How viable would it be to add some iso-locale and special case it to always use this format?
Digging through #879, it seems like I would need to modify FormatDate
, CultureInfo = ...
and probably AvailableLocales
? Would you accept a pr that adds such a locale, or would you prefer some other command line argument? (Not sure yet if and when I have time to get to creating a pr)
Would you accept a pr that adds such a locale, or would you prefer some other command line argument?
I don't think I want to include it in the scope of the project, at least as of now. You're welcome to make a fork for your own usage, though.
The en-SE
locale provides a similar format to ISO8601: 2024-01-12 21:31
, tooltip: Friday, 12 January 2024 21:31
This is the snippet I used to list locales and their date formats: https://dotnetfiddle.net/TWm6Et
using System;
using System.Globalization;
class Program
{
static void Main()
{
const string format = "{0,-11} | {1}";
foreach (CultureInfo ci in CultureInfo.GetCultures(CultureTypes.AllCultures))
{
Console.WriteLine(format, ci.Name, ci.DateTimeFormat.ShortDatePattern);
}
}
}
Closing this issue as "won't fix". HTML format is designed to mimic the look/behavior/feel of the Discord client as closely as possible. The dates, in particular, are rendered according to the selected culture, mimicking Discord's "language" setting. Note that you can hover your cursor over any date in the export, and it will show the timestamp in a more precise format. The bottom of the export file also contains the UTC offset used to calculate timestamps, and you can also override it to UTC+0 in settings.
For precise data processing, it's recommended to use the JSON format instead — it will, among others, preserve dates in ISO8601.