ng2-semantic-ui icon indicating copy to clipboard operation
ng2-semantic-ui copied to clipboard

Datepicker error

Open YaakovHatam opened this issue 7 years ago • 1 comments

https://github.com/edcarroll/ng2-semantic-ui/blob/348d2e5776cecf3928df8bc73a91cdd52b7d1c42/src/misc/util/helpers/date.ts#L178

I dont know why but when i deploy to production i get the error: Uncaught TypeError: r.getTime is not a function when i try to chanage a value in my datepicker.

After a little debugging i found the source file: node_modules\ng2-semantic-ui\dist\misc\util\helpers\date.js

and changed the function clone (line 168) from:

clone: function (date) {
        return new Date(date.getTime());
    }

to:

clone: function (date) {
		if (typeof t === 'string') {
			t = new Date(Date.parse(t))
		}
       return new Date(date.getTime());
   }

and now it works. i think it happen becuase i set up an hebrew localization.

Version of Angular, ng2-semantic-ui, and Semantic UI:

Angular: 5.2.0

ng2-semantic-ui: latest

Semantic UI: latest

YaakovHatam avatar Mar 29 '18 14:03 YaakovHatam

Thanks @kob-e this fixed my issue! I just had to change the var "t" to "date" on your example

brunohnq avatar Oct 02 '18 05:10 brunohnq