0

i want to format this date <b-button variant="outline-primary">{{getContract.contract_data.start_date}} | {{getContract.contract_data.end_date}}</b-button> Now it looks like this: enter image description here

I want it to be seen like this: enter image description here

how can i do?

I solved it with MomentJS: Convert date format in Javascript using VueJS

7
  • It seems like you're receiving the date as a string: what about tackling it at the source and ensuring that a unix timestamp (in ms) is being used? Then it is a matter of passing that number to the Date() object and using toLocaleString to format it any way you like. Commented Jan 10, 2022 at 9:11
  • Thanks @Terry how can i do this? Commented Jan 10, 2022 at 9:14
  • 1
    Ensure that your contract_data's start_date and end_date are unix timestamps not strings, convert it to a date object, i.e. new Date(getContract.contract_data.start_date), then read this: developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/… Commented Jan 10, 2022 at 9:16
  • Do you know momentJS? Commented Jan 10, 2022 at 9:25
  • 2
    stackoverflow.com/questions/46708110/… Commented Jan 10, 2022 at 9:27

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.