為了改善您的使用體驗,本網站正在進行維護,部分功能暫時無法使用。若本站的文件無法解決您的問題,想要向社群發問的話,請到 Twitter 上的 @FirefoxSupport 或 Reddit 上的 /r/firefox 發問,我們的社群成員將很快會回覆您的疑問。

搜尋 Mozilla 技術支援網站

防止技術支援詐騙。我們絕對不會要求您撥打電話或發送簡訊,或是提供個人資訊。請用「回報濫用」功能回報可疑的行為。

了解更多

Inconsistent behavior with date field in application on browser version 101.0.1

more options

I have my web application built using angular v8.0. In one of the page, we construct a date field in the corresponding component.ts file as following.

data: new Date(modifiedAt).toLocaleDateString('en-US',
                          { weekday: 'long',
                             year: 'numeric', 
                             month: 'long',
                             day: 'numeric',
                             hour: '2-digit',
                             minute: '2-digit' }),

Here modifiedAt is variable of type Date. The data attribute is then passed to an HTML template in another component.ts file and using date pipe from angular framework, we format this value as shown in below code snippet to display it in UI.

<span class="table_data-wrapper" title="{{ data | date : 'dd LLLL yyyyy h:mm a' }}">
      {{ data | date : 'd LLLL yyyy h:mm a' }}
    </span>

Now in Firefox 101.0.1 when this page loads and tries to display this value, we are getting the following error in the browser console.

ERROR Error: InvalidPipeArgument: 'Unable to convert "Wednesday, April 13, 2022 at 09:08 PM" into a date' for pipe 'ht'.

The same piece of code with no change in the 2 code snippets mentioned above in bold works just fine with older versions of Firefox. For e.g. with v 100.0 it works just fine and renders the date value appropriately. This issue is causing other things to break on our application in production. Can some one please provide help on what might be going wrong here ?

Thanks, Maneesh Sharma

I have my web application built using angular v8.0. In one of the page, we construct a date field in the corresponding component.ts file as following. <pre><nowiki>data: new Date(modifiedAt).toLocaleDateString('en-US', { weekday: 'long', year: 'numeric', month: 'long', day: 'numeric', hour: '2-digit', minute: '2-digit' }),</nowiki></pre><br> Here '''modifiedAt''' is variable of type ''Date''. The '''data''' attribute is then passed to an HTML template in another component.ts file and using date pipe from angular framework, we format this value as shown in below code snippet to display it in UI. <pre><nowiki><span class="table_data-wrapper" title="{{ data | date : 'dd LLLL yyyyy h:mm a' }}"> {{ data | date : 'd LLLL yyyy h:mm a' }} </span></nowiki></pre> Now in Firefox 101.0.1 when this page loads and tries to display this value, we are getting the following error in the browser console. ''ERROR Error: InvalidPipeArgument: 'Unable to convert "Wednesday, April 13, 2022 at 09:08 PM" into a date' for pipe 'ht'''. The same piece of code with no change in the 2 code snippets mentioned above in bold works just fine with older versions of Firefox. For e.g. with v 100.0 it works just fine and renders the date value appropriately. This issue is causing other things to break on our application in production. Can some one please provide help on what might be going wrong here ? Thanks, Maneesh Sharma

由 cor-el 於 修改

所有回覆 (3)

more options

This is the HTML snippet.

<span class="table_data-wrapper" title="{{ data | date : 'dd LLLL yyyyy h:mm a' }}">
      {{ data | date : 'd LLLL yyyy h:mm a' }}
</span>

由 cor-el 於 修改

more options

Unable to add full HTML snippet here. Attahcing a snapshot of the same.

由 maneessh 於 修改

more options

I have never developed in Angular or TypeScript, and I suspect there aren't a lot of other Angular/TypeScript developers volunteering here in Firefox support. Can someone trace the code through the library to the native JavaScript calls it sends to Firefox?