How to get first 3 letters of a month name in TypeScript

2 Answers

0 votes
const date = new Date(2022, 7, 12);

const shortName = date.toLocaleString('en-US', {month: 'short'});
console.log(shortName); 
   
   
   
/*
run:
   
"Aug" 
   
*/

 

 



answered Jun 14, 2022 by avibootz
0 votes
const date = new Date(2022, 0, 12);

const shortName = date.toLocaleString('en-US', {month: 'short'});
console.log(shortName); 
   
   
   
/*
run:
   
"Jan" 
   
*/

 



answered Jun 14, 2022 by avibootz

Related questions

2 answers 203 views
2 answers 152 views
1 answer 171 views
1 answer 138 views
1 answer 129 views
2 answers 172 views
...