You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardexpand all lines: readme.md
+14-3
Original file line number
Diff line number
Diff line change
@@ -18,8 +18,19 @@ Simply set `moment` as the filtering function and you're good to go. At least on
18
18
19
19
```html
20
20
<span>{{ someDate | moment "dddd, MMMM Do YYYY" }}</span>
21
+
<!-- or create a new date from 'now' -->
22
+
<span>{{ new Date() | moment "dddd, MMMM Do YYYY" }}</span>
21
23
```
22
24
25
+
## Passing Your Date
26
+
27
+
Moment.js expects your input to be either: a valid ISO 8601 formatted string (see <http://momentjs.com/docs/#/parsing/string/>), a valid `Date` object, or a date string with an accompanying format pattern (i.e. when you know the format of the date input). For the latter, `vue-moment` allows you to pass your date and format pattern(s) as an array, like such:
28
+
29
+
```html
30
+
<span>{{ [ someDate, "MM.DD.YY" ] | moment "dddd, MMMM Do YYYY" }}</span>
31
+
<!-- or when you want to parse against more than one pattern -->
32
+
<span>{{ [ someDate, ["MM.DD.YY", "MM-DD-YY", "MM-DD-YYYY"] ] | moment "dddd, MMMM Do YYYY" }}</span>
33
+
```
23
34
24
35
## Filtering Methods
25
36
@@ -62,11 +73,11 @@ Display a moment in relative time, either from now or from a specified date.
62
73
**With suffix hidden** (e.g. '4 days ago' -> '4 days')
63
74
64
75
```html
65
-
<span>{{ someDate | moment "from" "now" "true" }}</span>
76
+
<span>{{ someDate | moment "from" "now" true }}</span>
66
77
<!-- or -->
67
-
<span>{{ someDate | moment "from" "true" }}</span>
78
+
<span>{{ someDate | moment "from" true }}</span>
68
79
<!-- or with a reference time -->
69
-
<span>{{ someDate | moment "from" "Jan. 11th, 2000" "true" }}</span>
80
+
<span>{{ someDate | moment "from" "Jan. 11th, 2000" true }}</span>
70
81
```
71
82
72
83
For more information about `moment#fromNow` and `moment#from`, check out <http://momentjs.com/docs/#/displaying/fromnow/> and <http://momentjs.com/docs/#/displaying/from/>.
0 commit comments