mirror of
https://git.sr.ht/~cadence/bibliogram
synced 2026-03-01 18:31:35 +00:00
Add date to posts
This commit is contained in:
parent
00920d8f6d
commit
ba5a5a7653
4 changed files with 28 additions and 11 deletions
|
|
@ -27,6 +27,7 @@ class TimelineEntry extends TimelineBaseMethods {
|
|||
this.ownerPfpCacheP = null
|
||||
/** @type {import("./TimelineChild")[]} Not available until fetchChildren is called */
|
||||
this.children = null
|
||||
this.date = null
|
||||
}
|
||||
|
||||
async update() {
|
||||
|
|
@ -80,6 +81,21 @@ class TimelineEntry extends TimelineBaseMethods {
|
|||
* All mutations should act exactly once and have no effect on already mutated data.
|
||||
*/
|
||||
fixData() {
|
||||
this.date = new Date(this.data.taken_at_timestamp*1000)
|
||||
}
|
||||
|
||||
getDisplayDate() {
|
||||
function pad(number) {
|
||||
return String(number).padStart(2, "0")
|
||||
}
|
||||
return (
|
||||
`${this.date.getUTCFullYear()}`
|
||||
+ `-${pad(this.date.getUTCMonth()+1)}`
|
||||
+ `-${pad(this.date.getUTCDay()+1)}`
|
||||
+ ` ${pad(this.date.getUTCHours())}`
|
||||
+ `:${pad(this.date.getUTCMinutes())}`
|
||||
+ ` UTC`
|
||||
)
|
||||
}
|
||||
|
||||
getCaption() {
|
||||
|
|
|
|||
|
|
@ -105,7 +105,6 @@
|
|||
* @property {boolean} [has_ranked_comments]
|
||||
* @property {boolean} [comments_disabled]
|
||||
* @property {boolean} [commenting_disabled_for_viewer]
|
||||
* @property {number} [taken_at_timestamp]
|
||||
* @property {boolean} [is_ad]
|
||||
* @property {any} [edge_web_media_to_related_media] todo: discover
|
||||
* Image
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue