10
0
mirror of https://github.com/LCPQ/QUESTDB_website.git synced 2024-12-25 13:53:48 +01:00

Create pubUtils.getIssuedDate(publi) tool to get the date of a publication object

This commit is contained in:
Mickaël Véril 2020-05-04 13:57:20 +02:00
parent 414bbb44dc
commit 6d38d7be1f
3 changed files with 9 additions and 3 deletions

View File

@ -8,3 +8,4 @@
src="https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-mml-chtml.js"> src="https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-mml-chtml.js">
</script> </script>
<script src="https://cdn.rawgit.com/larsgw/citation.js/archive/citation.js/citation-0.4.0-9.js" type="text/javascript"></script> <script src="https://cdn.rawgit.com/larsgw/citation.js/archive/citation.js/citation-0.4.0-9.js" type="text/javascript"></script>
<script src="/js/pubUtils.js"></script>

View File

@ -50,8 +50,7 @@ function createPubliUI(publi,sets=new Map(),toolTips=false) {
else { else {
$("<span/>").text(publi["container-title"]).appendTo(journaldiv) $("<span/>").text(publi["container-title"]).appendTo(journaldiv)
} }
var datArr = publi.issued["date-parts"][0] var date = pubUtils.getIssuedDate(publi)
var date = new Date(datArr[0], datArr[1] - 1, datArr[2])
journaldiv.append(" ") journaldiv.append(" ")
$("<span/>").text(date.getFullYear().toString()).appendTo(journaldiv) $("<span/>").text(date.getFullYear().toString()).appendTo(journaldiv)
journaldiv.append(" ") journaldiv.append(" ")

6
static/js/pubUtils.js Normal file
View File

@ -0,0 +1,6 @@
class pubUtils{
static getIssuedDate(publi) {
const parts=publi.issued["date-parts"][0]
return new Date(parts[0], parts[1] - 1, parts[2])
}
}