Skip to content

Commit

Permalink
Merge pull request #1154 from NFDI4Chem/standardise-datepicker
Browse files Browse the repository at this point in the history
fix: standardise the dates displayed by datepicker
  • Loading branch information
CS76 authored Aug 14, 2024
2 parents 1e2f8e2 + bbbee16 commit aad1a62
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 0 deletions.
9 changes: 9 additions & 0 deletions resources/js/Mixins/Global.js
Original file line number Diff line number Diff line change
Expand Up @@ -336,6 +336,15 @@ export default {
}
return query.trim();
},
customDateFormat(date) {
if (!date) return "";
const day = String(date.getDate()).padStart(2, "0");
const month = String(date.getMonth() + 1).padStart(2, "0");
const year = date.getFullYear();
const hours = String(date.getHours()).padStart(2, "0");
const minutes = String(date.getMinutes()).padStart(2, "0");
return `${day}/${month}/${year}, ${hours}:${minutes}`;
},
},

computed: {
Expand Down
4 changes: 4 additions & 0 deletions resources/js/Pages/Announcement/Partials/Create.vue
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,8 @@
<Datepicker
v-model="createAnnouncementForm.start_time"
:min-date="new Date()"
:format="customDateFormat"
:preview-format="customDateFormat"
></Datepicker>
<jet-input-error
:message="createAnnouncementForm.errors.start_time"
Expand All @@ -90,6 +92,8 @@
</label>
<Datepicker
v-model="createAnnouncementForm.end_time"
:format="customDateFormat"
:preview-format="customDateFormat"
></Datepicker>
<jet-input-error
:message="createAnnouncementForm.errors.end_time"
Expand Down
4 changes: 4 additions & 0 deletions resources/js/Pages/Announcement/Partials/Edit.vue
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,8 @@
<Datepicker
v-model="editAnnouncementForm.start_time"
:min-date="new Date()"
:format="customDateFormat"
:preview-format="customDateFormat"
></Datepicker>
<jet-input-error
:message="editAnnouncementForm.errors.start_time"
Expand All @@ -87,6 +89,8 @@
</label>
<Datepicker
v-model="editAnnouncementForm.end_time"
:format="customDateFormat"
:preview-format="customDateFormat"
></Datepicker>
<jet-input-error
:message="editAnnouncementForm.errors.end_time"
Expand Down
5 changes: 5 additions & 0 deletions resources/js/Pages/Project/Show.vue
Original file line number Diff line number Diff line change
Expand Up @@ -575,6 +575,10 @@
v-model="
project.release_date
"
:format="customDateFormat"
:preview-format="
customDateFormat
"
></Datepicker>
<p
class="mt-1 text-sm text-gray-500"
Expand Down Expand Up @@ -1118,6 +1122,7 @@ export default {
const projectDetailsElement = ref(null);
const manageAuthorElement = ref(null);
const manageCitationElement = ref(null);
return {
projectDetailsElement,
manageAuthorElement,
Expand Down
2 changes: 2 additions & 0 deletions resources/js/Pages/Publish.vue
Original file line number Diff line number Diff line change
Expand Up @@ -431,6 +431,8 @@
v-model="publishForm.release_date"
@update:modelValue="updateProject"
:min-date="new Date()"
:format="customDateFormat"
:preview-format="customDateFormat"
></Datepicker>
<p class="mt-1 text-sm text-gray-500">
Publish your data now immediately or set a
Expand Down

0 comments on commit aad1a62

Please sign in to comment.