reports date range

This commit is contained in:
Mikola
2023-10-06 17:40:53 +03:00
parent 36052216fe
commit 38586b5209
3 changed files with 158 additions and 20 deletions

View File

@ -2,25 +2,25 @@ export function createMarkup(text) {
return { __html: text.split("</p>").join("</p>") };
}
export function transformHtml(text) {
let startHtml = {
__html: text.split("<h3> || <h2>").join("<br><h2>").split("<br>"),
};
startHtml = startHtml.__html.filter(
(el) => (el !== null && el !== "") || el === 0
);
const finalHtml = startHtml.map(
(item) =>
`<div class='experience__block'>
<div class="summary__sections__head">
<h3>Описание опыта работы</h3>
<button>Редактировать раздел</button>
</div>
<div class="experience__content">${item.split("<h3>")[0]}</div>
</div>`
);
return { __html: finalHtml.join("") };
}
// export function transformHtml(text) {
// let startHtml = {
// __html: text.split("<h3> || <h2>").join("<br><h2>").split("<br>"),
// };
// startHtml = startHtml.__html.filter(
// (el) => (el !== null && el !== "") || el === 0
// );
// const finalHtml = startHtml.map(
// (item) =>
// `<div class='experience__block'>
// <div class="summary__sections__head">
// <h3>Описание опыта работы</h3>
// <button>Редактировать раздел</button>
// </div>
// <div class="experience__content">${item.split("<h3>")[0]}</div>
// </div>`
// );
// return { __html: finalHtml.join("") };
// }
//
// export const setToken = () => {
// const url = new URL(window.location.href);
@ -64,6 +64,13 @@ export function getCorrectRequestDate(date) {
return `${yyyy}-${mm}-${dd} ${hh}:${min}:${sec}`;
}
export function getCorrectYYMMDD(date) {
const yyyy = String(date.getUTCFullYear());
const mm = String(date.getUTCMonth() + 1).padStart(2, "0");
const dd = String(date.getUTCDate()).padStart(2, "0");
return `${yyyy}-${mm}-${dd}`;
}
export function caseOfNum(number, type) {
const allTypes = {
comments: ["коментарий", "комментария", " коментариев"],