Daddoon / Blazor.Polyfill

Blazor server-side Polyfills and fixes for Internet Explorer 11 & Edge Legacy

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Datetime-local error

glararan opened this issue · comments

I have issue sending datetime-local from client to server
getting this error only if I dont step-by-step in debugger
SCRIPT5022: Invalid element type 'text'.

Code:

var datetime = moment($("#" + prop + "[type=datetime-local]").val(), "DD/MM/YYYY HH:mm").toDate();

 if (!isNaN(datetime))
   ref.invokeMethodAsync("SetDate", new Date(datetime.setHours(datetime.getHours() + 1)), prop);

Any idea what's wrong?

I don't think this is related directly to Blazor.Polyfill.

But it's maybe IE11.

Do your current code is working on other browsers, except IE11 ?

If yes, i think the best first step is to separate some of your code, in order to see if it's crashing at the date level, moment library level, or during the invokation method.

You may also try to add some "console.log" code in order to see if it crash before or after. Normally of course you would have debugged, but since you don't throw any error while being in debugger...

Also just for double checking that your page is not fallbacking in some idiotic compatibility mode on IE, see this: https://stackoverflow.com/questions/26346917/why-use-x-ua-compatible-ie-edge-anymore.

Otherwise if nothing is resolved after your debugging session, are you sure, while working with IE11, that the request component has already been rendered on the page ? I mean, it should, but maybe the debugger may mitigate some behavior ? Do you have this error if you put your code in a setTimeout method and wait for some milliseconds before firing back your code ?

I have already meta tag for compability IE=edge.

Im sure it throws error during invoking method.

Chrome is fine.

Component is 100% rendered. Im dealing with input.onchange event

Actually there is no support of datetime-local on IE11. See Browser compatibility section on this Mozilla page: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/Input/datetime-local

IE11 is not listed.
Did you have searched and/or added a polyfill for IE11 for this feature ?
I don't have tested myself, you may look here: https://github.com/jonstipe/datetime-local-polyfill

ok thanks