mariomka / vue-datetime

Mobile friendly datetime picker for Vue. Supports date and datetime modes, i18n and more.
http://mariomka.github.io/vue-datetime
MIT License
986 stars 245 forks source link

Dynamic format #236

Open DucatiGuy opened 4 years ago

DucatiGuy commented 4 years ago

Versions

Description: Want to format date based on distance from current date

Is there an existing technique to dynamically format the date returned by the picker? e.g. one of the following Today 12:34 Tues 12.34 Tues 1 Oct 12:34

I have a function (formatDate) which returns a suitable format and have tried:

    <Datetime v-model="enterDateTime" 
              type="datetime" 
              title="Time to commence work" 
              :format="formatDate(enterStartDateTime)" 
              @input="formatDate(enterStartDateTime)" >
    </Datetime>

The above initially displays the date correctly but the format doesn't change on return from the picker.