Angular - Using the DatePipe for date formatting

Having trouble displaying a date correctly on Internet Explorer using Angular. The code works perfectly on Chrome, Firefox, and other browsers, but not on IE. Here is the code snippet :

<span>{{menu.modifiedDate ? (menu.modifiedDate | date : "dd-MM-y HH:mm:ss") : '-'}}</span>

This is the output in Google Chrome :

15-06-2017 08:39:39

However, this is what Internet Explorer is displaying :

15-06-2017 08:00:6/15/2017 8:39:39 AM:6/15/2017 8:39:39 AM 

Can anyone help me figure out what's causing the issue?

Answer №1

This issue dates back quite a while. You can find more information on it here: https://github.com/angular/angular.js/issues/13880

It's possible that you're using an outdated version of the software. Updating to the most recent stable release should resolve the issue.

Answer №2

Encountering issues with IE is a common occurrence. One effective solution involves creating a custom pipe, such as the one shown below:

import { Pipe, PipeTransform } from '@angular/core';

    @pipe({
    name: 'date'
    })

    export class DataPipe implements PipeTransform {
    transform(value: string): string {

        let dd = value.substr(8, 2);
        let MM = value.substr(5, 2);
        let yyyy = value.substr(0, 4);
        let date = `${dd}/${MM}/${yyyy}`;

        return `${date}`;
    }
    }

Implementing this custom pipe can help resolve the issue you are facing.

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

The filter becomes ineffective once I remove the input value

Check out this HTML table containing an input field that filters plans. https://i.stack.imgur.com/UfIw2.png I input the value => 1 The filter successfully works https://i.stack.imgur.com/CsQXh.png Removing the value (1) displays all recordings, tot ...

Tips for integrating dynamic external components into Angular applications

I have encountered an issue with my Angular application. My goal is to create an Angular application written in TypeScript and built with (aot). The objective is to create a user dashboard with various widgets, each widget being an Angular component. Wh ...

Is it possible to retrieve and utilize multiple Enum values in Typescript?

Combine enum values to retrieve corresponding enum strings. Consider the following scenario: enum EnumDays { NONE = 0, SUN = 1, MON = 2, TUE = 4, WED = 8, THU = 16, FRI = 32, SAT = 64, ALL = 127 } If I pass a value o ...

Ways to decrease the node_module size within an Angular application and how to efficiently load Node_Modules directly from the index.html or the root

Looking to decrease the size of node_module (currently 605MB) and load Node_Modules from index.html or application root. Using Angular 5 with node 8.9.4 Various solutions have been attempted but without the desired outcome, npm install --production Git ...

Encountered an unhandled exception: Module 'source-map' not found while attempting to run Angular on a Raspberry Pi

I am currently developing an Angular application to run on a Raspberry Pi. However, I encountered the following error when trying to start the application: An unhandled exception occurred: Cannot find module 'source-map' Require stack: - /home/pi ...

Flag is activated to retrieve the data from the @Input source

@Input() config= []; flag = false; I need to change the flag to true only when I receive data in the config from the @input. Where should I do this? The data in the config is delayed and I am unable to access it in ngOnInit but can get it in ngOnChanges. ...

Encountering issues with Angular 12 optimized build, the error messages are sparse and offer little

While my project compiles without any issues in development mode with the build optimizer turned off, I encounter an error during production build: ✔ Browser application bundle generation complete. ✔ ES5 bundle generation complete. ✔ Copying assets c ...

There is no universal best common type that can cover all return expressions

While implementing Collection2 in my angular2-meteor project, I noticed that the code snippets from the demo on GitHub always result in a warning message being displayed in the terminal: "No best common type exists among return expressions." Is there a ...

The Semantic UI Tabs in Angular 4 only function properly once they have been clicked on

I have set up semantic UI tabs in my app.component.html as shown below: <div class = "ui container"> <h1>Header/h1> <hr> <div style = "background-color: rgb(194, 221, 240);" class="ui top attached tab ...

Guide to displaying loading progress during server response delay in React with TypeScript

I need to find a way to update the loading state to false once the server responds. The challenge is that the response occurs in one component, while the progress bar is located in another. To illustrate the scenario: const Form: React.FC = () => { ...

Oh no, an issue has occurred with The Angular Compiler! It appears that TypeScript version 3.9.10 was found instead of the required version, which should be >=3.6.4 and <

After upgrading my angular application from version 5 to version 9, I encountered an issue while trying to deploy my code on the server. ERROR in The Angular Compiler requires TypeScript >=3.6.4 and <3.9.0 but 3.9.10 was found instead. Even though ...

Learn how to securely download files from an Azure Storage Container using Reactjs

I'm currently working on applications using reactjs/typescript. My goal is to download files from azure storage v2, following a specific path. The path includes the container named 'enrichment' and several nested folders. My objective is to ...

Troubles encountered with fetching pre-filled values in Angular form automation

In my project, there is a template driven angular form for the Edit profile section in the app. Data is populated from the API for the form, with fields being empty if no data is available. When a user types new data into the fields, it is successfully pos ...

What is the best way to utilize the typescript module for detecting and managing typescript errors and warnings in your code?

Currently, I am experimenting with the typescript module to programmatically detect typescript errors. Below is a simplified version of what I have been working on: var ts=require('typescript') var file_content=` interface Message{ a:string ...

Angular 17 component fails to detect signal updates

When I set the value of a signal from component A using a service, it returns null when attempting to access the signal from component B (not the child). I recall this working in Angular 16, did something change in Angular 17? Service @Injectable({ pr ...

Unable to fetch packages from npm or github using jspm install because of proxy configuration restrictions

I'm attempting to execute a basic Angular 2 unit test application. I have cloned the following git repository and followed the steps provided in the readme file: https://github.com/matthewharwood/Hit-the-gym I have configured proxy settings for npm, ...

Issues with Angular unit tests failing due to an unexpected phantomJS error

Executing ng test triggers the execution of my 3 unit tests which have been hardcoded to pass successfully, as shown below: describe('AppComponent', () => { beforeEach(async(() => { TestBed.configureTestingModule({ imports: [ ...

ReactJS: error occurs when trying to fetch data and encountering issues with reading properties

I am currently attempting to initiate an API call (a GET request) in order to download a document. However, I am encountering an error when making the API call: TypeError: Cannot read properties of undefined (reading 'payload') const printPin ...

Divide Angular ngFor into separate divs

Here is an example of my current array: [a, b, c, d, e, f, g, h, i] I am aiming to iterate through it using ngFor and split it into groups of 3 elements. The desired output should look like this: <div class="wrapper"> <div class="main"> ...

Steps for updating the same array in TypeScript

I have written a reducer code where I check if the same value is already present in the array. If it is, I update the previous value instead of pushing the same value again. Here is my code snippet: export function reducer( state: IDeviceState = ...