diff --git a/snippets/dayName.md b/snippets/dayName.md index 2c1a32732..cbda0bd8d 100644 --- a/snippets/dayName.md +++ b/snippets/dayName.md @@ -3,15 +3,13 @@ title: dayName tags: date,beginner --- -Gets the name of the weekday from a `Date` object, optionally for a given locale. +Gets the name of the weekday from a `Date` object. -- Use `new Date()` or `new Date('mm/dd/yyyy')` to find the weekday. - Use `Date.prototype.toLocaleDateString()` with the `{ weekday: 'long' }` option to retrieve the weekday. -- Use the optional second parameter for language specific name. If not used, returns the default locale. +- Use the optional second parameter to get a language-specific name or omit it to use the default locale. ```js -const dayName = ( date, locale ) => - date.toLocaleDateString(locale, { weekday: 'long' }) +const dayName = (date, locale) => date.toLocaleDateString(locale, { weekday: 'long' }); ``` ```js