Import inventaire: format date when needed
This commit is contained in:
@@ -12,6 +12,16 @@
|
|||||||
date: String,
|
date: String,
|
||||||
isbn: String,
|
isbn: String,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
function displayDate(date) {
|
||||||
|
const regex = /^\d{4}-\d{2}-\d{2}$/;
|
||||||
|
if (regex.test(date)) {
|
||||||
|
const d = new Date(date);
|
||||||
|
return d.toLocaleDateString();
|
||||||
|
} else {
|
||||||
|
return date;
|
||||||
|
}
|
||||||
|
}
|
||||||
const imagePathOrDefault = computed(() => getInventaireImagePathOrDefault(props.image));
|
const imagePathOrDefault = computed(() => getInventaireImagePathOrDefault(props.image));
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
@@ -28,7 +38,8 @@
|
|||||||
</div>
|
</div>
|
||||||
<div class="media-content">
|
<div class="media-content">
|
||||||
<div class="is-size-4">{{title}}</div>
|
<div class="is-size-4">{{title}}</div>
|
||||||
<div v-if="props.date" class="is-size-5">{{$t('importlistelement.releasedate') + "" + date}}</div>
|
<div v-if="props.date" class="is-size-5">{{$t('importlistelement.releasedate') + "" +
|
||||||
|
displayDate(date)}}</div>
|
||||||
<div v-if="props.publisher" class="is-size-5">{{$t('importlistelement.publisher') + "" + publisher}}</div>
|
<div v-if="props.publisher" class="is-size-5">{{$t('importlistelement.publisher') + "" + publisher}}</div>
|
||||||
<div v-if="props.isbn" class="is-size-5">{{"ISBN: " + isbn}}</div>
|
<div v-if="props.isbn" class="is-size-5">{{"ISBN: " + isbn}}</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -19,7 +19,7 @@
|
|||||||
let error = ref(null);
|
let error = ref(null);
|
||||||
|
|
||||||
const pageTotal = computed(() => {
|
const pageTotal = computed(() => {
|
||||||
let countValue = (data.value !== null) ? data.value['count'] : 0;
|
const countValue = (data.value !== null) ? data.value['count'] : 0;
|
||||||
return Math.ceil(countValue / limit);
|
return Math.ceil(countValue / limit);
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -28,7 +28,7 @@
|
|||||||
|
|
||||||
function fetchData(searchTerm, authorId) {
|
function fetchData(searchTerm, authorId) {
|
||||||
if (searchTerm != null) {
|
if (searchTerm != null) {
|
||||||
let lang = navigator.language.substring(0,2);
|
const lang = navigator.language.substring(0,2);
|
||||||
getSearchBooks(data, error, searchTerm, lang, limit, offset.value);
|
getSearchBooks(data, error, searchTerm, lang, limit, offset.value);
|
||||||
} else if (authorId != null) {
|
} else if (authorId != null) {
|
||||||
getAuthorBooks(data, error, authorId, limit, offset.value);
|
getAuthorBooks(data, error, authorId, limit, offset.value);
|
||||||
|
|||||||
Reference in New Issue
Block a user