Adding date and time to news content

This commit is contained in:
Inga Kirschnick 2022-12-21 15:23:59 +01:00
parent f5a1cf75dd
commit e633b834c6
2 changed files with 10 additions and 6 deletions

View File

@ -548,9 +548,9 @@ class User(HashidMixin, UserMixin, db.Model):
'email': self.email, 'email': self.email,
'last_seen': ( 'last_seen': (
None if self.last_seen is None None if self.last_seen is None
else f'{self.last_seen.isoformat()}Z' else self.last_seen.strftime('%Y-%m-%d %H:%M')
), ),
'member_since': f'{self.member_since.isoformat()}Z', 'member_since': self.member_since.strftime('%Y-%m-%d'),
'username': self.username, 'username': self.username,
'full_name': self.full_name, 'full_name': self.full_name,
'about_me': self.about_me, 'about_me': self.about_me,

View File

@ -197,13 +197,16 @@
} }
function mastodonStatusToHtml(status) { function mastodonStatusToHtml(status) {
let date = new Date(status.created_at).toLocaleString('en-US')
return htmlString = ` return htmlString = `
<div class="row"> <div class="row">
<div class="col s11"> <div class="col s11">
<div class="card white-text" style="background-color:#5D50E7; border-radius:10px;"> <div class="card white-text" style="background-color:#5D50E7; border-radius:10px;">
<div class="card-content"> <div class="card-content">
<span class="card-title">New Actitvity on Mastodon</span> <span class="card-title">New Actitvity on Mastodon</span>
${status.content} <p><i>Published on ${date}</i></p>
<br>
<p>${status.content}</p>
</div> </div>
</div> </div>
</div> </div>
@ -213,10 +216,10 @@
`.trim(); `.trim();
} }
function bisBlogsEntryToHtml(entry) { function bisBlogsEntryToHtml(entry) {
let date = new Date(entry.published).toLocaleString('en-US')
let bisBlogHTMLElement = document.createElement('div'); let bisBlogHTMLElement = document.createElement('div');
bisBlogHTMLElement.classList.add('row'); bisBlogHTMLElement.classList.add('row');
bisBlogHTMLElement.innerHTML = ` bisBlogHTMLElement.innerHTML = `
<div class="row">
<div class="col s1"> <div class="col s1">
<img src="https://blogs.uni-bielefeld.de/blog/uniintern/resource/themabilder/unilogo-square.svg" alt="Bielefeld University Blogs" class="responsive-img hide-on-small-only" style="width:70%; margin-top:40px;"> <img src="https://blogs.uni-bielefeld.de/blog/uniintern/resource/themabilder/unilogo-square.svg" alt="Bielefeld University Blogs" class="responsive-img hide-on-small-only" style="width:70%; margin-top:40px;">
</div> </div>
@ -224,8 +227,9 @@
<div class="card" style="background-color: #A5BDCC; border-radius:10px;"> <div class="card" style="background-color: #A5BDCC; border-radius:10px;">
<div class="card-content"> <div class="card-content">
<span class="card-title">${entry.title['#text']}</span> <span class="card-title">${entry.title['#text']}</span>
${entry.content['#text']} <p><i>Published on ${date}</i></p>
</div> <br>
<p>${entry.content['#text']}</p>
</div> </div>
</div> </div>
</div> </div>