Quantcast
Channel: Active questions tagged html - Stack Overflow
Viewing all articles
Browse latest Browse all 74846

How to customise Intl.DateTimeFormat date?

$
0
0

I'm trying to update dates in my angular 6 application using Intl.DateTimeFormat and passing locale and dateStyle, timeStyle options. I'm able to get the custom date while trying in browser console however as soon as I try to integrate the same in my app, it throws compilation error: Type '{ dateStyle: string; timeStyle: string; }' has no properties in common with type 'DateTimeFormatOptions'.

    transformDate() {
    const options = { dateStyle: "full", timeStyle: "medium" };
    console.log(new Intl.DateTimeFormat('en-US',options).format(this.date));
  }

Viewing all articles
Browse latest Browse all 74846

Latest Images

Trending Articles



Latest Images

<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>