Skip to content

Commit 90bd2dc

Browse files
authored
Merge pull request #55 from bjuppa/optional-locale-args
Make locale parameters optional
2 parents 195f4cf + 443fa3c commit 90bd2dc

File tree

5 files changed

+13
-13
lines changed

5 files changed

+13
-13
lines changed

ExPlainDate.ts

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -141,31 +141,31 @@ export function ExPlainDate(
141141
});
142142
},
143143

144-
toLocaleStringMedium(locale = undefined) {
144+
toLocaleStringMedium(locale) {
145145
return formatPlainDate(locale)({ dateStyle: "medium" })(this);
146146
},
147-
toLocaleStringLong(locale = undefined) {
147+
toLocaleStringLong(locale) {
148148
return formatPlainDate(locale)({ dateStyle: "long" })(this);
149149
},
150-
toLocaleStringFull(locale = undefined) {
150+
toLocaleStringFull(locale) {
151151
return formatPlainDate(locale)({ dateStyle: "full" })(this);
152152
},
153-
dayName(locale = undefined) {
153+
dayName(locale) {
154154
return formatPlainDate(locale)({ weekday: "long" })(this);
155155
},
156-
dayNameShort(locale = undefined) {
156+
dayNameShort(locale) {
157157
return formatPlainDate(locale)({ weekday: "short" })(this);
158158
},
159-
dayNameNarrow(locale = undefined) {
159+
dayNameNarrow(locale) {
160160
return formatPlainDate(locale)({ weekday: "narrow" })(this);
161161
},
162-
monthName(locale = undefined) {
162+
monthName(locale) {
163163
return formatPlainDate(locale)({ month: "long" })(this);
164164
},
165-
monthNameShort(locale = undefined) {
165+
monthNameShort(locale) {
166166
return formatPlainDate(locale)({ month: "short" })(this);
167167
},
168-
monthNameNarrow(locale = undefined) {
168+
monthNameNarrow(locale) {
169169
return formatPlainDate(locale)({ month: "narrow" })(this);
170170
},
171171

PlainDate.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,7 @@ export function PlainDate(
144144
return this.iso;
145145
},
146146

147-
toLocaleString(locale = undefined, options = { dateStyle: "short" }) {
147+
toLocaleString(locale, options = { dateStyle: "short" }) {
148148
return utcDate.toLocaleDateString(locale, {
149149
...options,
150150
timeZone: "UTC",

PlainTime.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ export function PlainTime(
126126
return this.toString();
127127
},
128128

129-
toLocaleString(locale = undefined, options = { timeStyle: "short" }) {
129+
toLocaleString(locale, options = { timeStyle: "short" }) {
130130
return epochUtcDate.toLocaleTimeString(locale, {
131131
...options,
132132
timeZone: "UTC",

utils/formatPlainDate.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ import { ComPlainDate, FormatPlainDateOptions } from "../PlainDate.ts";
2323
* ```
2424
*/
2525
export function formatPlainDate(
26-
locale: Intl.LocalesArgument = undefined,
26+
locale?: Intl.LocalesArgument,
2727
): (options?: FormatPlainDateOptions) => (date: ComPlainDate) => string {
2828
return (options = {}) => (date) => date.toLocaleString(locale, options);
2929
}

utils/formatPlainTime.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ import { ComPlainTime, FormatPlainTimeOptions } from "../PlainTime.ts";
2323
* ```
2424
*/
2525
export function formatPlainTime(
26-
locale: Intl.LocalesArgument = undefined,
26+
locale?: Intl.LocalesArgument,
2727
): (options?: FormatPlainTimeOptions) => (time: ComPlainTime) => string {
2828
return (options = {}) => (time) => time.toLocaleString(locale, options);
2929
}

0 commit comments

Comments
 (0)