Rename date function

pull/21833/head
Jaiwanth 2021-06-01 21:52:04 +05:30
parent 01a3b854c3
commit c63c59b408
2 changed files with 4 additions and 4 deletions

View File

@ -138,7 +138,7 @@ export function wantsDateSeparator(prevEventDate: Date, nextEventDate: Date): bo
} }
export function formatFullDateNoDayNoTime(date: Date) { export function formatFullDateNoDay(date: Date) {
return ( return (
date.getFullYear() + date.getFullYear() +
"-" + "-" +

View File

@ -9,7 +9,7 @@ import { Exporter } from "./Exporter";
import { renderToStaticMarkup } from 'react-dom/server' import { renderToStaticMarkup } from 'react-dom/server'
import { Layout } from "../../settings/Layout"; import { Layout } from "../../settings/Layout";
import { shouldFormContinuation } from "../../components/structures/MessagePanel"; import { shouldFormContinuation } from "../../components/structures/MessagePanel";
import { formatFullDateNoDayNoTime, wantsDateSeparator } from "../../DateUtils"; import { formatFullDateNoDay, wantsDateSeparator } from "../../DateUtils";
import { RoomPermalinkCreator } from "../permalinks/Permalinks"; import { RoomPermalinkCreator } from "../permalinks/Permalinks";
import * as ponyfill from "web-streams-polyfill/ponyfill" import * as ponyfill from "web-streams-polyfill/ponyfill"
import * as Avatar from "../../Avatar"; import * as Avatar from "../../Avatar";
@ -205,7 +205,7 @@ export default class HTMLExporter extends Exporter {
fileDirectory = "files"; fileDirectory = "files";
break; break;
} }
const fileDate = formatFullDateNoDayNoTime(new Date(event.getTs())); const fileDate = formatFullDateNoDay(new Date(event.getTs()));
const [fileName, fileExt] = this.splitFileName(event.getContent().body); const [fileName, fileExt] = this.splitFileName(event.getContent().body);
const filePath = fileDirectory + "/" + fileName + '-' + fileDate + '.' + fileExt; const filePath = fileDirectory + "/" + fileName + '-' + fileDate + '.' + fileExt;
return filePath; return filePath;
@ -283,7 +283,7 @@ export default class HTMLExporter extends Exporter {
for (const iconName in exportIcons) { for (const iconName in exportIcons) {
this.zip.file(`icons/${iconName}`, exportIcons[iconName]); this.zip.file(`icons/${iconName}`, exportIcons[iconName]);
} }
const filename = `matrix-export-${formatFullDateNoDayNoTime(new Date())}.zip`; const filename = `matrix-export-${formatFullDateNoDay(new Date())}.zip`;
//Generate the zip file asynchronously //Generate the zip file asynchronously
const blob = await this.zip.generateAsync({ type: "blob" }); const blob = await this.zip.generateAsync({ type: "blob" });