diff --git a/src/components/note.jsx b/src/components/note.jsx
index 2e21884..37148e1 100644
--- a/src/components/note.jsx
+++ b/src/components/note.jsx
@@ -16,7 +16,7 @@
*/
import RenderMarkdown from "../components/markdown";
-import { printDate } from "./utils";
+import { timestamp2text } from "./utils";
function Note({ note }) {
return (
@@ -26,7 +26,7 @@ function Note({ note }) {
{note.name}
- {`${printDate(note.time)} ${
+ {`${timestamp2text(note.time)} ${
note.pub ? `| ${locals.PublicNote}` : `| ${locals.LocalNote}`
}`}
diff --git a/src/components/utils.js b/src/components/utils.js
index 2f89b78..88f672d 100644
--- a/src/components/utils.js
+++ b/src/components/utils.js
@@ -17,7 +17,7 @@
import { Locales } from "../localisation/main";
-function printDate(time) {
+function timestamp2text(time) {
time = new Date(time);
return time.toLocaleString(settings.language);
}
@@ -48,4 +48,4 @@ async function getNetLocale(lang, fileName) {
return (await (await fetch(`localisation/${lang}/${fileName}`)).text()) || "";
}
-export { printDate, reRenderPage, localesProcess, getNetLocale };
+export { timestamp2text, reRenderPage, localesProcess, getNetLocale };
diff --git a/src/pages/create.jsx b/src/pages/create.jsx
index 2304045..266149e 100644
--- a/src/pages/create.jsx
+++ b/src/pages/create.jsx
@@ -20,7 +20,7 @@ import { ChevronDoubleRightIcon } from "@heroicons/react/24/outline";
import { CheckBox } from "../components/checkbox";
import { useState } from "react";
import RenderMarkdown from "../components/markdown";
-import { printDate } from "../components/utils";
+import { timestamp2text } from "../components/utils";
import rehypeRemark from "rehype-remark/lib";
import ContentEditable from "react-contenteditable";
import ReactDOMServer from "react-dom/server";
@@ -162,7 +162,7 @@ function CreateNote() {
{name}
- {printDate(Date.now())}
+ {timestamp2text(Date.now())}
)}
diff --git a/src/pages/notes.jsx b/src/pages/notes.jsx
index 4c3e80a..acb2a9a 100644
--- a/src/pages/notes.jsx
+++ b/src/pages/notes.jsx
@@ -17,7 +17,7 @@
import { ButtonWithIcon } from "../components/button";
import { ChevronDoubleRightIcon } from "@heroicons/react/24/outline";
-import { printDate } from "../components/utils";
+import { timestamp2text } from "../components/utils";
import Fuse from "fuse.js";
import { inputStyle } from "../components/styles";
import { useState } from "react";
@@ -30,7 +30,7 @@ function Notes() {
let notes = Object.entries(notesObj);
for (let [id, note] of notes) {
note.id = id;
- note.textTime = printDate(note.time);
+ note.textTime = timestamp2text(note.time);
notesObj[id] = note;
}
localStorage.setObj("Notes", notesObj);
@@ -82,7 +82,7 @@ function Notes() {
{item.name}
-
{printDate(item.time)}
+
{timestamp2text(item.time)}
.
*/
-import { printDate } from "../components/utils";
+import { timestamp2text } from "../components/utils";
import { ChevronDoubleLeftIcon } from "@heroicons/react/24/outline";
import { ButtonWithIcon } from "../components/button";
import { useSearchParams } from "react-router-dom";
@@ -39,7 +39,7 @@ function PubError() {
{locals.PubError}
- {printDate(Date.now())}
+ {timestamp2text(Date.now())}
{err ? err : locals.PubErrorMsg}
diff --git a/src/pages/pubNote.jsx b/src/pages/pubNote.jsx
index 59fc0f7..a1e2a97 100644
--- a/src/pages/pubNote.jsx
+++ b/src/pages/pubNote.jsx
@@ -18,7 +18,7 @@
import RenderMarkdown from "../components/markdown";
import { useState } from "react";
import { Navigate, useParams } from "react-router-dom";
-import { printDate } from "../components/utils";
+import { timestamp2text } from "../components/utils";
import { ChevronDoubleLeftIcon } from "@heroicons/react/24/outline";
import { ButtonWithIcon } from "../components/button";
@@ -73,7 +73,7 @@ function PubNote() {
{note.name || "Загрузка..."}
- {printDate(note.time || Date.now())}
+ {timestamp2text(note.time || Date.now())}
diff --git a/src/pages/save-local.jsx b/src/pages/save-local.jsx
index 1b2b423..96b594e 100644
--- a/src/pages/save-local.jsx
+++ b/src/pages/save-local.jsx
@@ -16,7 +16,7 @@
*/
import { Navigate } from "react-router-dom";
-import { printDate } from "../components/utils";
+import { timestamp2text } from "../components/utils";
function uuidv4() {
return ([1e7] + -1e3 + -4e3 + -8e3 + -1e11).replace(/[018]/g, (c) =>
@@ -44,7 +44,7 @@ function Save() {
name,
text,
time,
- textTime: printDate(time),
+ textTime: timestamp2text(time),
pubTime,
pub: !!pubTime,
};