I'm switching my website from onyx DatePicker to GTS Date Picker to get the full calendar display. I've got the basics working, but I have one issue. It looks as if the currently selected month should show up between the previous and next month buttons. It is not displayed and I am getting the following error when I press either of the buttons: TypeError: currMonth.format is not a function DatePicker.js:529.

Not quite sure where to go with it. Any help would be greatly appreciated.




  • edited January 2013
    Ah, my bad. That is another component from my kind set. You can hack it in by adding the following code to your project or including the PrototypeExt folder from gts-plugins (same thing that contains GTS.DatePicker). I should make note of that in the code.

    The text between the buttons is set to read something like March 2012 when functional. The .format function is a shortcut for using the enyo.g11n package to format the date to something human readable. I guess I should set up a detection for the .format function so it doesn't error out.
    Date.prototype.format = function( dtFormat, locale ) {
    	if( enyo.g11n ) {
    		if( dtFormat == "special" ) {
    			dtFormat = { date: "yyyy-MM-dd", time: "HH:mm:ss" };
    		} else if( typeof( dtFormat ) === "undefined" ) {
    			dtFormat = { date: "medium", time: "short" };
    		} else if( !enyo.isString( dtFormat ) ) {
    			if( typeof( dtFormat['date'] ) === "undefined" ) {
    				dtFormat['date'] = "medium";
    			} else if( typeof( dtFormat['time'] ) === "undefined" ) {
    				dtFormat['time'] = "short";
    		var fmt = new enyo.g11n.DateFmt( dtFormat );
    		return fmt.format( this );
    	return "";
  • That worked. Thanks for the quick response and the great plugin!
  • edited January 2013
    Okay, fixed dependence of more of my code. It now checks for enyo.g11n and uses it if found. If not, it will output date.getMonth() - date.getFullYear().

    The dependence was a holdover from when g11n wasn't built yet and my .format function was more complicated.
  • In case anyone is still using these awesome kinds, I started migrating a fork to Enyo 2.7. So far the only part I need is DatePicker and I got that working. I'm a weekend code hack, so my apologies if I'm doing this all wrong! At any rate, there is an updated fiddle at: and the fork I'm working on is at I haven't updated any of the comments, nor have I worked on migrating from g11n to iLib, since it will work even with the broken g11n references. Examples really help me and it was fun to start with some great code and break it and make it work again!
Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!