Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

95
Visualizações
Date Subtracting 1 from my day on my Web application

For some reason, I am having problems getting my date select text box to display the proper DAY in my mm/dd/yyyy section. It seems to be subtracting one off of the day when I select january 4th it will display January 3rd. If any advice could be spared it would be greatly appreciated, as I am a mere novice.

Here is some code supporting this problem, if any more information or code is needed feel free to ask.

This is my AddEntry.vue page

   <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>
about 4 years ago · Juan Pablo Isaza
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda