function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Lauren BLauren B 

Date Format in mm/yyyyy in LWC.

Hi,
I have a requirement where I have to show date in mm/yyyy and user can enter date only in this format. This is I'm trying in  LWC. Please assist.
Suraj Tripathi 47Suraj Tripathi 47
Hi Lauren B

Below is the Example of the formatted date as you Expected one

let currentDate = new Date();

let formatter = new Intl.DateTimeFormat('en', {
year: "numeric" ,
month: "numeric",
day: "numeric",
hour: "2-digit",
minute: "2-digit",
hour12: "true"
})
let formattedDate = formatter.format(currentDate);
return `${this.sectionTitle} (as of ${formattedDate})`;

Hope you find your solution.
Thanks