Skip to content

Commit

Permalink
Update ArticleReference.js (#619)
Browse files Browse the repository at this point in the history
should fix #615
add rule to fix issued year in ref (similar to csl)
  • Loading branch information
danieleguido authored Feb 26, 2024
1 parent 7c3c5b2 commit 5b06315
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions src/models/ArticleReference.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,15 @@ export default class ArticleReference {
this.shortRefText = ''

if (ref) {
if (ref.issued && ref.issued.year) {
year = ref.issued.year
} else if (ref.issued && ref.issued.literal) {
year = ref.issued.literal
} else if (ref.accessed && ref.accessed.year) {
if (ref.issued) {
if (Array.isArray(ref.issued['date-parts']) && ref.issued['date-parts'].length > 0) {
year = ref.issued['date-parts'][0][0]
} else if (ref.issued.year) {
year = ref.issued.year
} else if (ref.issued.literal) {
year = ref.issued.literal
}
} else if (ref.accessed?.year) {
year = ref.accessed.year
}
// set shortRef accodring to different condition: use elseif
Expand Down

0 comments on commit 5b06315

Please sign in to comment.