]> git.ipfire.org Git - thirdparty/moment.git/commit
Call calendar format function with moment context
authorgeneralov <e.generalov@gmail.com>
Tue, 26 Apr 2016 14:46:42 +0000 (19:46 +0500)
committerIskren Chernev <iskren.chernev@gmail.com>
Tue, 14 Jun 2016 09:07:31 +0000 (02:07 -0700)
commitf2c17e02b53b3bda932d969ccf41ba8fb9588c31
treeca3d25a49c3640ebf904f476d082e2f3df6cfef4
parent6d72a469dcee7117763b2286cdfdad20aa72550c
Call calendar format function with moment context

What: the code:
```
moment().days(-1000).calendar(null, {
   sameElse: function() {
       return '[hoy a la' + ((this.hours() !== 1) ? 's' : '') + '] LT';
   }
});
```
Where: on http://momentjs.com/docs/#/displaying/calendar-time/ in the Chrome console.
What I got: It raises `Uncaught TypeError: this.hours is not a function`

I expected use callback like in the example on http://momentjs.com/docs/#/customization/calendar/ .

This PR makes the compatible call with https://github.com/moment/moment/blob/develop/src/lib/locale/calendar.js#L14
src/lib/moment/calendar.js