-
Notifications
You must be signed in to change notification settings - Fork 426
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: added moment and date-fns examples (#650)
* feat: added moment and date-fns examples fixes #218 * yarn.lock, lint * clearable, current date by default
- Loading branch information
1 parent
64bb7c0
commit c653406
Showing
5 changed files
with
91 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,78 @@ | ||
<template> | ||
<v-container grid-list-md> | ||
<v-layout row wrap> | ||
<v-flex xs12 lg6> | ||
<v-menu | ||
v-model="menu1" | ||
:close-on-content-click="false" | ||
full-width | ||
max-width="290" | ||
> | ||
<v-text-field | ||
slot="activator" | ||
:value="computedDateFormattedMomentjs" | ||
clearable | ||
label="Formatted with Moment.js" | ||
readonly | ||
></v-text-field> | ||
<v-date-picker | ||
v-model="date" | ||
@change="menu1 = false" | ||
></v-date-picker> | ||
</v-menu> | ||
</v-flex> | ||
|
||
<v-flex xs12 lg6> | ||
<v-menu | ||
v-model="menu2" | ||
:close-on-content-click="false" | ||
full-width | ||
max-width="290" | ||
> | ||
<v-text-field | ||
slot="activator" | ||
:value="computedDateFormattedDatefns" | ||
clearable | ||
label="Formatted with datefns" | ||
readonly | ||
></v-text-field> | ||
<v-date-picker | ||
v-model="date" | ||
@change="menu2 = false" | ||
></v-date-picker> | ||
</v-menu> | ||
</v-flex> | ||
</v-layout> | ||
</v-container> | ||
</template> | ||
|
||
<script> | ||
import moment from 'moment' | ||
import format from 'date-fns/format' | ||
export default { | ||
data: () => ({ | ||
date: new Date().toISOString().substr(0, 10), | ||
menu1: false, | ||
menu2: false | ||
}), | ||
computed: { | ||
computedDateFormattedMomentjs () { | ||
return this.date ? moment(this.date).format('dddd, MMMM Do YYYY') : '' | ||
}, | ||
computedDateFormattedDatefns () { | ||
return this.date ? format(this.date, 'dddd, MMMM Do YYYY') : '' | ||
} | ||
} | ||
} | ||
</script> | ||
|
||
<codepen-resources lang="json"> | ||
{ | ||
"js": [ | ||
"https://cdnjs.cloudflare.com/ajax/libs/moment.js/2.22.2/moment.min.js", | ||
"https://cdnjs.cloudflare.com/ajax/libs/date-fns/1.29.0/date_fns.min.js" | ||
] | ||
} | ||
</codepen-resources> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2475,7 +2475,7 @@ dashdash@^1.12.0: | |
dependencies: | ||
assert-plus "^1.0.0" | ||
|
||
date-fns@^1.23.0, date-fns@^1.27.2: | ||
date-fns@^1.23.0, date-fns@^1.27.2, date-fns@^1.29.0: | ||
version "1.29.0" | ||
resolved "https://registry.yarnpkg.com/date-fns/-/date-fns-1.29.0.tgz#12e609cdcb935127311d04d33334e2960a2a54e6" | ||
integrity sha512-lbTXWZ6M20cWH8N9S6afb0SBm6tMk+uUg6z3MqHPKE9atmsY3kJkTm8vKe93izJ2B2+q5MV990sM2CHgtAZaOw== | ||
|
@@ -5651,6 +5651,11 @@ [email protected], [email protected], mkdirp@^0.5.0, mkdirp@^0.5.1, mkdirp@~0.5.0: | |
dependencies: | ||
minimist "0.0.8" | ||
|
||
moment@^2.22.2: | ||
version "2.22.2" | ||
resolved "https://registry.yarnpkg.com/moment/-/moment-2.22.2.tgz#3c257f9839fc0e93ff53149632239eb90783ff66" | ||
integrity sha1-PCV/mDn8DpP/UxSWMiOeuQeD/2Y= | ||
|
||
move-concurrently@^1.0.1: | ||
version "1.0.1" | ||
resolved "https://registry.yarnpkg.com/move-concurrently/-/move-concurrently-1.0.1.tgz#be2c005fda32e0b29af1f05d7c4b33214c701f92" | ||
|