|
|
@@ -13,22 +13,24 @@ var MonthExpression = module.exports = function MonthExpression(){
|
|
|
base.call(this);
|
|
|
}, klass = MonthExpression, base = require("./NaryExpression"), proto = klass.prototype = Object.create(base.prototype, {constructor:{value:klass}});
|
|
|
|
|
|
+ // DEPENDENCIES
|
|
|
+var Expression = require("./Expression");
|
|
|
+
|
|
|
// PROTOTYPE MEMBERS
|
|
|
proto.getOpName = function getOpName(){
|
|
|
return "$month";
|
|
|
};
|
|
|
|
|
|
-proto.addOperand = function addOperand(expr) {
|
|
|
- this.checkArgLimit(1);
|
|
|
- base.prototype.addOperand.call(this, expr);
|
|
|
-};
|
|
|
-
|
|
|
/**
|
|
|
* Takes a date and returns the month as a number between 1 and 12.
|
|
|
* @method evaluate
|
|
|
- **/
|
|
|
-proto.evaluate = function evaluate(doc){
|
|
|
+ **/
|
|
|
+proto.evaluateInternal = function evaluateInternal(vars){
|
|
|
this.checkArgCount(1);
|
|
|
- var date = this.operands[0].evaluate(doc);
|
|
|
- return date.getUTCMonth() + 1;
|
|
|
+ var date = this.operands[0].evaluateInternal(vars);
|
|
|
+ console.log("test", date.getUTCMonth() );
|
|
|
+ return date.getUTCMonth();
|
|
|
};
|
|
|
+
|
|
|
+/** Register Expression */
|
|
|
+Expression.registerExpression("$month",MonthExpression.getOpName);
|