Browse Source

Fixed story chapter fictionalDate field weirdness, especially when it's not provided.

master 1.3.1
Gisle Aune 5 years ago
parent
commit
3a057f6f24
  1. 8
      marko/page/story-content/components/comment/index.marko
  2. 10
      marko/page/story-content/components/edit-comment-modal/component.js

8
marko/page/story-content/components/comment/index.marko

@ -67,9 +67,11 @@ import moment from "moment"
<for (paragraph in state.paragraphs)>
<div class="message-text color-text">
<markdown class="body" source=paragraph>
<span class="decoration color-menu">[</span>
<date class="color-menu" value=input.comment.fictionalDate></date>
<span class="decoration color-menu">]&nbsp;</span>
<if (input.comment.fictionalDate)>
<span class="decoration color-menu">[</span>
<date class="color-menu" value=input.comment.fictionalDate></date>
<span class="decoration color-menu">]&nbsp;</span>
</if>
<span class="decoration color-menu">&lt;</span>
<span if(input.comment.character != null) class="tooltip color-primary">
<span>${input.comment.characterName}</span>

10
marko/page/story-content/components/edit-comment-modal/component.js

@ -28,11 +28,19 @@ module.exports = class {
})
const comment = input.comment
let fictionalDate = new Date(comment.fictionalDate)
if (comment.fictionalDate && !Number.isNaN(fictionalDate.getTime()) && fictionalDate.getTime() !== 0) {
fictionalDate = moment(fictionalDate).format("MMM D, YYYY")
} else {
fictionalDate = ""
}
this.state.values = {
subject: comment.subject,
characterId: comment.characterId,
characterName: comment.characterName,
fictionalDate: moment(comment.fictionalDate).format("MMM D, YYYY"),
fictionalDate: fictionalDate,
source: comment.source,
}
}

Loading…
Cancel
Save