Add prototype accessor moment.fn

The `Moment` prototype is exposed through `moment.fn`.
This commit is contained in:
Matt Brooks
2015-08-10 15:00:21 +01:00
parent 3b0f362204
commit b090bcf9ba
3 changed files with 7 additions and 2 deletions
+4
View File
@@ -456,4 +456,8 @@ moment.locale('en', {
}
});
moment.fn.toJSON = function() {
return this.format();
};
console.log(moment.version);
+2 -1
View File
@@ -1,6 +1,6 @@
// Type definitions for Moment.js 2.8.0
// Project: https://github.com/timrwood/moment
// Definitions by: Michael Lakerveld <https://github.com/Lakerfield>, Aaron King <https://github.com/kingdango>, Hiroki Horiuchi <https://github.com/horiuchi>, Dick van den Brink <https://github.com/DickvdBrink>, Adi Dahiya <https://github.com/adidahiya>
// Definitions by: Michael Lakerveld <https://github.com/Lakerfield>, Aaron King <https://github.com/kingdango>, Hiroki Horiuchi <https://github.com/horiuchi>, Dick van den Brink <https://github.com/DickvdBrink>, Adi Dahiya <https://github.com/adidahiya>, Matt Brooks <https://github.com/EnableSoftware>
// Definitions: https://github.com/borisyankov/DefinitelyTyped
declare module moment {
@@ -371,6 +371,7 @@ declare module moment {
interface MomentStatic {
version: string;
fn: Moment;
(): Moment;
(date: number): Moment;
+1 -1
View File
@@ -1,6 +1,6 @@
// Type definitions for Moment.js 2.8.0
// Project: https://github.com/timrwood/moment
// Definitions by: Michael Lakerveld <https://github.com/Lakerfield>, Aaron King <https://github.com/kingdango>, Hiroki Horiuchi <https://github.com/horiuchi>, Dick van den Brink <https://github.com/DickvdBrink>, Adi Dahiya <https://github.com/adidahiya>
// Definitions by: Michael Lakerveld <https://github.com/Lakerfield>, Aaron King <https://github.com/kingdango>, Hiroki Horiuchi <https://github.com/horiuchi>, Dick van den Brink <https://github.com/DickvdBrink>, Adi Dahiya <https://github.com/adidahiya>, Matt Brooks <https://github.com/EnableSoftware>
// Definitions: https://github.com/borisyankov/DefinitelyTyped
/// <reference path="moment-node.d.ts" />