Skip to content

Commit 178c5ca

Browse files
committed
Adds locale support for some static methods on Datetime class. See #72685
1 parent 986322f commit 178c5ca

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

src/elements/DateTime/DateTime.coffee

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1424,16 +1424,23 @@ class CUI.DateTime extends CUI.Input
14241424

14251425
# limit output to the given types
14261426
# the library is very awkward here...
1427-
@formatWithInputTypes: (datestr, output_types, output_format) ->
1427+
@formatWithInputTypes: (datestr, output_types, output_format, locale = null) ->
14281428
if not datestr
14291429
return null
14301430

1431-
dt = new CUI.DateTime(input_types: output_types)
1431+
opts = {
1432+
input_types: output_types
1433+
}
1434+
if locale
1435+
opts.locale = locale
1436+
1437+
dt = new CUI.DateTime(opts)
14321438
mom = dt.parseValue(datestr)
1439+
14331440
if not mom.isValid()
14341441
return null
14351442

1436-
dt.format(mom, output_format)
1443+
dt.format(mom, output_format, null, false)
14371444

14381445
@display: (datestr_or_moment, opts={}) ->
14391446
if not opts.hasOwnProperty("input_types")

0 commit comments

Comments
 (0)