diff --git a/md-parser/src/components/ArticleForm.vue b/md-parser/src/components/ArticleForm.vue index dc8b52a5..c4181588 100644 --- a/md-parser/src/components/ArticleForm.vue +++ b/md-parser/src/components/ArticleForm.vue @@ -7,13 +7,13 @@
-
+
-
+
@@ -47,6 +47,14 @@ export default { "date_modified": this.date_modified, "title": this.title } + }, + // Input-ready current day. + // Based on https://gomakethings.com/setting-a-date-input-to-todays-date-with-vanilla-js/. + today (){ + let obj = new Date() + return obj.getFullYear().toString() + "-" + + (obj.getMonth() +1).toString().padStart(2,0) + "-" + + obj.getDate().toString().padStart(2,0) } }, watch: { @@ -64,14 +72,11 @@ export default { }, }, methods : { - // WIP : sets meta date to today. - // params: date= 1 => set date_created - // date = 2 => set date_modified - setToday : function(date) { - this.$store.commit('today', date) - }, sendMeta: function(){ this.$store.commit('updateMeta', this.meta) + }, + setToday(id){ + document.getElementById(id).value = this.today } }