Por alguna razón, tengo problemas para que mi cuadro de texto de selección de fecha muestre el DÍA correcto en mi sección mm/dd/aaaa. Parece estar restando uno del día cuando selecciono el 4 de enero, se mostrará el 3 de enero. Si se pudiera ahorrar algún consejo, sería muy apreciado, ya que soy un mero novato.
Aquí hay un código que respalda este problema, si necesita más información o código, no dude en preguntar.
Esta es mi página AddEntry.vue
<script> export default { data() { return { location: "", endUser: "", orderNumber: "", date: null, application: "", serviceTech: "", department: "", hours: 0, travelHours: 0, contactName: "", reason: "", }; }, computed: { serviceEntry() { let tmpEntry = {}; tmpEntry.location = this.location; tmpEntry.endUser = this.endUser; tmpEntry.orderNumber = this.orderNumber; tmpEntry.date = this.date; tmpEntry.application = this.application; tmpEntry.serviceTech = this.serviceTech; tmpEntry.department = this.department; tmpEntry.hours = this.hours; tmpEntry.travelHours = this.travelHours; tmpEntry.contactName = this.contactName; tmpEntry.reason = this.reason; return tmpEntry; }, }, methods: { setServiceDate(event) { // alert(event.target.valueAsDate.toLocaleDateString('en-US')) this.date = event.target.valueAsDate; // alert(this.date) }, formatDate(date) { var d = new Date(date), month = "" + (d.getMonth() + 1), day = "" + d.getDate(), year = d.getFullYear(); if (month.length < 2) month = "0" + month; if (day.length < 2) day = "0" + day; return [year, month, day].join("-"); }, async submitItem() { if (this.$store.dispatch("createServiceEntry", this.serviceEntry)) this.$router.push({ path: `/`, }); }, }, mounted() { this.date = new Date(); }, }; </script>