Skip to content

Commit

Permalink
Merge pull request #6 from mtsknn/patch-1
Browse files Browse the repository at this point in the history
  • Loading branch information
xxczaki authored Sep 12, 2020
2 parents 2fcc508 + 7f536e6 commit cdcf2ad
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 3 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@
"name": "localeFormat",
"path": "dist/index.esm.js",
"import": "{localeFormat}",
"limit": "177 B"
"limit": "165 B"
}
],
"dependencies": {}
Expand Down
3 changes: 1 addition & 2 deletions src/locale.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
* localeFormat(new Date(2014, 1, 11), '{MMM}') //=> 'Jan'
*/
export default (date: Date, exp: string, locale: string | string[] = 'en-US'): string => exp.replace(/{.*?}/g, key => {
const shortWeekday = new Intl.DateTimeFormat(locale, {weekday: 'short'}).format(date);
switch (key) {
case '{MMMMM}':
return new Intl.DateTimeFormat(locale, {month: 'narrow'}).format(date);
Expand All @@ -25,7 +24,7 @@ export default (date: Date, exp: string, locale: string | string[] = 'en-US'): s
case '{EEE}':
case '{EE}':
case '{E}':
return shortWeekday;
return new Intl.DateTimeFormat(locale, {weekday: 'short'}).format(date);
/* c8 ignore next 2 */
default:
return '';
Expand Down

0 comments on commit cdcf2ad

Please # to comment.