Intl.DateTimeFormat custom pattern output

2015-08-16 Thread Muhammad Hussein Fattahizadeh
​I want to use Intl.DateTimeFormat https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/DateTimeFormat but with custom pattern for output. I use this method for php version of ICU dateformat and it's work well. $fmt = datefmt_create( 'fa_IR@calendar=persian',

Re: Proposal for a null coalescing operator

2015-08-16 Thread Michael McGlothlin
In JS it seems it'd be more useful if it worked with undefined not null. Thanks, Michael McGlothlin Sent from my iPhone On Aug 16, 2015, at 7:33 PM, Brandon Andrews warcraftthre...@sbcglobal.net wrote: https://en.wikipedia.org/wiki/Null_coalescing_operator Essentially x ?? y will return

Proposal for a null coalescing operator

2015-08-16 Thread Brandon Andrews
https://en.wikipedia.org/wiki/Null_coalescing_operator Essentially x ?? y will return x when not null or undefined else it will return y. A nice Javascript explanation of the current problems with using || that can cause unforeseen bugs: http://stackoverflow.com/a/476445

Re: Proposal for a null coalescing operator

2015-08-16 Thread Isiah Meadows
This is something I frequently make a helper function out of. ```js function d(argument, default_) { return argument != null ? argument : default_ } ``` On Sun, Aug 16, 2015, 20:34 Brandon Andrews warcraftthre...@sbcglobal.net wrote: https://en.wikipedia.org/wiki/Null_coalescing_operator

Re: Proposal for a null coalescing operator

2015-08-16 Thread Kevin Smith
A link to a wikipedia article is not *actually* a proposal : ) As Michael points out, you need to at least provide some consideration for null vs. undefined. I would also like to see some thought given to how such an operator might interact with a null propagation operator, discussed here:

Re: Intl.DateTimeFormat custom pattern output

2015-08-16 Thread Norbert Lindenberg
Intl.DateTimeFormat doesn’t currently let you specify a custom pattern in ICU/CLDR format. The reason is that the API had to be implemented on top of different existing internationalization APIs, and the API on Windows didn’t support CLDR date format patterns. There is a feature request for

`null` and default arguments

2015-08-16 Thread Isiah Meadows
I know it's a little late for this, but what was the rationale of using only `undefined` instead of both that and `null` to denote omitted values for optional arguments in ES6? Before this change, it was a frequent idiom to check optional arguments via `== null` instead of `=== undefined` and pass