I am writing a jquery lib and I need to implement the datetime functions. I need to create a datedate () function that returns a new date object.
How to pass the arguments of the date arg (for arg) function to date constructor so that a new date object can be created?
I tried to do something like this, I have the plugin name space, I = $ JqGUI
//.Date(Value) / * Return a date item * ReturnValue = Date (value) * / me.Date = function (value) {// Close constructor var to sdate = Date.prototype.constructor.apply (faucet, logic); Console.log (sDate); // Create a date object d var d = new Date (sDate); // Validate date object if (d.toDateString () == "invalid date") (New error ("$ .jqGUI.Date: invalid date");} and {return D;}}; < / Pre> Here I pass date.prototype.constructor but in any case I get the current date. If the argument is a date string on which it is ignored. Why? < / Div>
var args = Array.prototype.concat.apply ([null], logic); New return (function. Prototype.binds.apple (date, day) S)); If your target browser does not support ECMAScript 5 Function.prototype.bind, then the code will not work. This is not very likely, though see.
Comments
Post a Comment