mirror of
https://github.com/onkelbeh/cheatsheets.git
synced 2026-08-15 21:44:51 +02:00
moment: link to You Don't Need Moment
This commit is contained in:
21
moment.md
21
moment.md
@@ -9,19 +9,20 @@ tags: [Featurable]
|
|||||||
### Parsing
|
### Parsing
|
||||||
|
|
||||||
```js
|
```js
|
||||||
m = moment("2013-03-01", "YYYY-MM-DD")
|
m = moment('2013-03-01', 'YYYY-MM-DD')
|
||||||
```
|
```
|
||||||
|
|
||||||
This parses the given date using the given format. Returns a moment object.
|
This parses the given date using the given format. Returns a moment object.
|
||||||
|
|
||||||
### Formatting
|
### Formatting
|
||||||
|
|
||||||
```js
|
```js
|
||||||
m
|
m
|
||||||
.format()
|
.format()
|
||||||
.format('dddd')
|
.format('dddd')
|
||||||
.format("MMM Do YY") // → "Sep 2nd 07"
|
.format('MMM Do YY') // → "Sep 2nd 07"
|
||||||
.fromNow() // → "31 minutes ago"
|
.fromNow() // → "31 minutes ago"
|
||||||
.calendar() // → "Last Friday at 9:32PM"
|
.calendar() // → "Last Friday at 9:32PM"
|
||||||
```
|
```
|
||||||
|
|
||||||
### Add
|
### Add
|
||||||
@@ -56,6 +57,12 @@ See [datetime](./datetime) for more.
|
|||||||
|
|
||||||
## References
|
## References
|
||||||
|
|
||||||
* [Datetime cheatsheet](./datetime) _(devhints.io)_
|
### Alternatives
|
||||||
* [Moment website](http://momentjs.com/) _(momentjs.com)_
|
|
||||||
* [Moment docs](http://momentjs.com/docs/) _(momentjs.com)_
|
* [You don't need Moment.js](https://github.com/you-dont-need/You-Dont-Need-Momentjs) _(github.com)_
|
||||||
|
|
||||||
|
### Also see
|
||||||
|
|
||||||
|
* [Datetime cheatsheet](./datetime) _(devhints.io)_
|
||||||
|
* [Moment website](http://momentjs.com/) _(momentjs.com)_
|
||||||
|
* [Moment docs](http://momentjs.com/docs/) _(momentjs.com)_
|
||||||
|
|||||||
Reference in New Issue
Block a user