Edge throws “TypeMismatchError” when setting custom header for fetch request with formated date

Confirmed Issue #11358518 • Assigned to Mohamed K.

Details

Author
Michael H.
Created
Mar 22, 2017
Privacy
This issue is public.
Found in
  • Microsoft Edge
Reports
Reported by 1 person

Sign in to watch or report this issue.

Steps to reproduce

Whilst this is working in IE & Chrome, Edge throws TypeMismatchError when setting a custom header to a fetch request using request.headers.set('x-date', dateStr);.

Here are my findings so far:

This is working:

request.headers.set('x-date', '1/9/2014 8:51:15 AM');

This is working:

const dateStr = '1/9/2014 8:51:15 AM';
request.headers.set('x-date', dateStr);

This is working:

const dateStr = Moment().format('l LTS');
request.headers.set('x-date', dateStr);

This is not working:

const dateStr = new Date().toLocaleString('en-US').replace(',', '');
request.headers.set('x-date', dateStr);

I don’t see any differences when logging Moment().format('l LTS') & new Date().toLocaleString('en-US').replace(',', '') to the console…

Attachments

Comments and activity

  • Microsoft Edge Team

    Changed Assigned To to “James M.”

    Changed Status to “Not reproducible”

  • Hello,

    Thank you for providing this information about the issue. After thorough testing, we are unable to reproduce this problem in Edge with the information at hand. Please update this case when you can provide more details, such as a sample code we may review.

    Best Wishes,
    The MS Edge Team

  • Changed Status from “Not reproducible”

  • I’ve created a sample app which can be reached here.

    If you click Fetch it with Use vanilla date unchecked, the x-date header value is created using moment js and everything is working as expected.

    With Use vanilla date checked, the x-date header value is generated using vanilla JS (new Date().toLocaleString...) and Edge is throwing the TypeMismatchError.

    Also see the screenshot I’ve attached to the issue itself.

    Both options are working just fine in Chrome 57 & Firefox 52.

  • Microsoft Edge Team

    Changed Assigned To to “James M.”

    Changed Assigned To to “Venkat K.”

    Changed Assigned To from “Venkat K.” to “Mohamed K.”

    Changed Status to “Confirmed”

You need to sign in to your Microsoft account to add a comment.

Sign in