mirror of
https://code.castopod.org/adaures/castopod
synced 2025-04-23 01:01:20 +00:00

- merge publication date fields into one field instanciated with flatpickr datetime picker - get user timezone to convert user publication_date input to UTC - remove setPublishedAt() method from episode entity - add publication pill component to display the episode publication date info - clear cache after episode insert - use CI is_really_writable() helper in install instead of is_writable() - fix latest episodes layout - update tsconfig to only include ts folders - update DEPENDENCIES.md to include flatpickr - add format_duration helper to format episode enclosure duration instead of translating it (causes translation bug) - add Time.ts module to convert UTC time to user localized time for episode publication dates - fix some layout issues - update php and js dependencies to latest versions closes #47
25 lines
715 B
TypeScript
25 lines
715 B
TypeScript
const Time = (): void => {
|
|
const timeElements: NodeListOf<HTMLTimeElement> = document.querySelectorAll(
|
|
"time"
|
|
);
|
|
|
|
console.log(timeElements);
|
|
|
|
for (let i = 0; i < timeElements.length; i++) {
|
|
const timeElement = timeElements[i];
|
|
|
|
// convert UTC date value to user timezone
|
|
const timeElementDateTime = timeElement.getAttribute("datetime");
|
|
|
|
// check if timeElementDateTime is not null and not a duration
|
|
if (timeElementDateTime && !timeElementDateTime.startsWith("PT")) {
|
|
const dateTime = new Date(timeElementDateTime);
|
|
|
|
// replace <time/> title with localized datetime
|
|
timeElement.setAttribute("title", dateTime.toLocaleString());
|
|
}
|
|
}
|
|
};
|
|
|
|
export default Time;
|