Not setting value of timeline tag
See original GitHub issueSince you’re not setting the value here, the field won’t get populated when the user restarts Obsidian.
Style-nit: you switch between camelCase, PascalCase, and snake_case a lot. Javascript and Typescript styleguides tend to prefer camelCase for all variable names and function names.
It’s a lot safer to use string interpolation like this:
const someString = `my name is ${name}`;
rather than using +. + is weird in JS and you might unknowingly cast a string to a number.
https://github.com/Darakah/obsidian-timelines/blob/685dddb902b990085af34c94fe6170112daf1c8a/main.ts#L25
_this
is unused.
https://github.com/Darakah/obsidian-timelines/blob/685dddb902b990085af34c94fe6170112daf1c8a/main.ts#L79-L82 I recommend using a code formatter since your indentation is often incorrect, making it hard to review.
https://github.com/Darakah/obsidian-timelines/blob/685dddb902b990085af34c94fe6170112daf1c8a/main.ts#L90
I don’t think this works? Number.isInteger("1")
returns false.
https://github.com/Darakah/obsidian-timelines/blob/685dddb902b990085af34c94fe6170112daf1c8a/main.ts#L122 When is this nullable? You probably want to filter instead otherwise the alternation logic won’t work.
I really recommend against building the html with string concatenation since it’s easy to make a mistake and it’s hard to debug. Also, since you’re using user data, it will need to be properly escaped - right now a user can’t use '
in their description.
Issue Analytics
- State:
- Created 3 years ago
- Comments:13 (7 by maintainers)
Top GitHub Comments
Oh, I see. You are parsing the string as a number by prepending it with a slash. It’s probably easier just to validate the date with MomentJS (you can use
window.moment(formattedStr)
here) instead if you can make assumptions about how the date is formatted.Okay, sounds like the behavior is intended.