0

So I'm trying to use pickadate.js plugin with angular I have two inputs, one for "started" date, and one for "finished" date, the problem is I need to prevent problems like, (started date is greater than finished date)

my inputs:

                <input id="genWork_periodInitial"
                    name="genWork_periodInitial"
                    ng-model="set.work.model.startedAt"
                    date-format="set.work.model.instance.startedAt"
                    required
                    type="text"
                    pickadate
                    options="{
                        format: 'dd/mm/yyyy',
                        selectYears: 50,
                        selectMonths: true,
                        max: set.work.model.finishedAt
                    }">

Finished date:

            <input type="text" id="genWork_periodEnd"
                name="genWork_periodEnd" 
                ng-model="set.work.model.finishedAt"
                date-format="set.work.model.instance.finishedAt"
                class="profile-edit-professional-work-year-end-input"
                required
                pickadate
                options="{
                    format: 'dd/mm/yyyy',
                    selectYears: 50,
                    selectMonths: true,
                    min: set.work.model.startedAt,
                    max: moment().toDate()
                }">

set.work.model.startedAt, and .finishedAt, returns values like this: 01/02/2015

Someone can help about this?

Matt Johnson-Pint
  • 230,703
  • 74
  • 448
  • 575
Wagner Moreira
  • 1,033
  • 1
  • 16
  • 40
  • It's good that you're showing *some* code, but instead you should show us code that reproduces the problem in isolation. We have no idea what your model looks like, or what data it contains. Please read [How to create a Minimal, Complete, and Verifiable example](http://stackoverflow.com/help/mcve). – Matt Johnson-Pint Oct 01 '15 at 17:22
  • Also, `moment().toDate()` is equivalent to `new Date()`. No need for moment if that's all you need. Pickadate doesn't use it. – Matt Johnson-Pint Oct 01 '15 at 17:23

0 Answers0