Eonasdan/bootstrap-datetimepicker — pull request #666 by Koloto (2014-11-24 15:02:09+00:00)
Title: v4: option extraFormats to improve parsing

`moment` supports an array of formats to parse. I think it's a good idea to support several 'parse' formats and one 'output' format in the `datetimepicker` too. So I introduced an option `extraFormats` - an array of optional formats which can be used while parsing. `format` option specify output format and it is also used as the last parse format. Why the last? For example I want to display four-digit year but also support two-digit year. I specify the following options:
```js
{
format: 'DD.MM.YYYY',
extraFormats: [ 'DD.MM.YY' ]
}
```
According to the documentation `moment` "prefers formats earlier in the array than later":
```js
moment('1.1.1', [ 'DD.MM.YYYY', 'DD.MM.YY' ]); // 0001-01-01 - not clear
moment('1.1.1', [ 'DD.MM.YY', 'DD.MM.YYYY' ]); // 2001-01-01 - correct
```
So we must place longer formats at the end of array.
I suppose output format is typically the longest. But if someone wants to change this logic he can add `format` value into `extraFormats` at any index, e.g.:
```js
{
format: 'DD.MM.YYYY',
extraFormats: [ 'DD.MM.YYYY', 'DD.MM.YY' ]
}
```

I also looked at #616: there the first element of array is always used as output format. I think it's incorrect in many cases (see example above).