class Teaser { constructor(date, title, urlToImage, description, url) { this.publishedAt = publishedAt; this.title = title; this.urlToImage = urlToImage; this.description = description; this.url = url; } } /** * * @param {Teaser} teaser */ var getTeaserTemplate = function (teaser) { const publishedAt = formateDate(teaser.publishedAt); return `
${publishedAt}
${teaser.title}
${teaser.description} ... more
`; }; var formateDate = function (dateString) { const date = new Date(dateString); const dateTimeFormat = new Intl.DateTimeFormat("de", { year: "numeric", month: "2-digit", day: "2-digit", }); const [ { value: day }, , { value: month }, , { value: year }, ] = dateTimeFormat.formatToParts(date); return `${day}.${month}.${year}`; }; export { Teaser, getTeaserTemplate };