diff --git a/front/src/ImportListElement.vue b/front/src/ImportListElement.vue
index 9abb5d0..6c7e7c0 100644
--- a/front/src/ImportListElement.vue
+++ b/front/src/ImportListElement.vue
@@ -12,6 +12,16 @@
date: 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));
@@ -28,7 +38,8 @@
{{title}}
-
{{$t('importlistelement.releasedate') + "" + date}}
+
{{$t('importlistelement.releasedate') + "" +
+ displayDate(date)}}
{{$t('importlistelement.publisher') + "" + publisher}}
{{"ISBN: " + isbn}}
diff --git a/front/src/SearchBook.vue b/front/src/SearchBook.vue
index dc07270..c5688b2 100644
--- a/front/src/SearchBook.vue
+++ b/front/src/SearchBook.vue
@@ -19,7 +19,7 @@
let error = ref(null);
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);
});
@@ -28,7 +28,7 @@
function fetchData(searchTerm, authorId) {
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);
} else if (authorId != null) {
getAuthorBooks(data, error, authorId, limit, offset.value);