Fix "Export chat" not respecting configured time format in plain text mode (#10696)
* #23838 Fix "Export chat" time format in plain text mode * #23838 Fix import of matrix-js-sdk * Remove hardcoded locale Co-authored-by: Michael Weimann <mail@michael-weimann.eu> * Fix test for readability Signed-off-by: Rashmit Pankhania <raspankh@publicisgroupe.net> * Fix test Signed-off-by: Rashmit Pankhania <raspankh@publicisgroupe.net> * Fix test Signed-off-by: Rashmit Pankhania <raspankh@publicisgroupe.net> * Fix test Signed-off-by: Rashmit Pankhania <rashmitpankhania@gmail.com> Signed-off-by: Rashmit Pankhania <raspankh@publicisgroupe.net> * Use dateUtils formatFullDate function Signed-off-by: Rashmit Pankhania <raspankh@publicisgroupe.net> --------- Signed-off-by: Rashmit Pankhania <raspankh@publicisgroupe.net> Signed-off-by: Rashmit Pankhania <rashmitpankhania@gmail.com> Co-authored-by: Rashmit Pankhania <raspankh@publicisgroupe.net> Co-authored-by: Michael Weimann <mail@michael-weimann.eu> Co-authored-by: Michael Telatynski <7t3chguy@gmail.com>
This commit is contained in:
parent
6a14362697
commit
b08bdf7e0d
2 changed files with 46 additions and 6 deletions
|
@ -23,6 +23,8 @@ import { _t } from "../../languageHandler";
|
|||
import { ExportType, IExportOptions } from "./exportUtils";
|
||||
import { textForEvent } from "../../TextForEvent";
|
||||
import { haveRendererForEvent } from "../../events/EventTileFactory";
|
||||
import SettingsStore from "../../settings/SettingsStore";
|
||||
import { formatFullDate } from "../../DateUtils";
|
||||
|
||||
export default class PlainTextExporter extends Exporter {
|
||||
protected totalSize: number;
|
||||
|
@ -121,7 +123,12 @@ export default class PlainTextExporter extends Exporter {
|
|||
if (this.cancelled) return this.cleanUp();
|
||||
if (!haveRendererForEvent(event, this.room.client, false)) continue;
|
||||
const textForEvent = await this.plainTextForEvent(event);
|
||||
content += textForEvent && `${new Date(event.getTs()).toLocaleString()} - ${textForEvent}\n`;
|
||||
content +=
|
||||
textForEvent &&
|
||||
`${formatFullDate(
|
||||
new Date(event.getTs()),
|
||||
SettingsStore.getValue("showTwelveHourTimestamps"),
|
||||
)} - ${textForEvent}\n`;
|
||||
}
|
||||
return content;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue