angular-moment-picker icon indicating copy to clipboard operation
angular-moment-picker copied to clipboard

Date bind to ng-model should be in the same format as format set in config

Open f-jost opened this issue 7 years ago • 0 comments

Hi,

In the config:

 momentPickerProvider.options({
        'locale': 'en',
        'format': 'YYYY/MM/DD'
      })

When user select the date in the picker, the output date that is bind to ng-model should be in the same format as format in the config, because actually if a user select 1985/03/02 the output date is "1985-03-01T23:00:00.000Z" and we have to re-format the date like user.momentDate.format('YYYY/MM/DD). So we must format two time the date, first in the config and second in the controller.

Another issue I encountered is if I set the locale in the config to 'fr' for example and that I set start-date option to moment('1985/01/01'), the picker display now the information in english and not in french, so we have to re-set the locale to the start date like this.startDate = moment('1985/01/01').locale('fr')

f-jost avatar Mar 02 '18 10:03 f-jost