lukejagodzinski / meteor-astronomy-validators

https://atmospherejs.com/jagi/astronomy-validators
MIT License
11 stars 13 forks source link

Returning a nested date for the lt, lte, gt and gte validators #18

Closed ghost closed 9 years ago

ghost commented 9 years ago

I was wondering if there's anyway to return a nested value inside a compareValue for the comparaison validators like Validators.lt().

For example, i've got two dates, and i need to know if the first one is before the second one. The problem being that those date are inside an array of objects like this:

'schedules.$.monday.morning_start': {
            type: 'date',
            validators: [
                Validators.required(),
                Validators.date(),
                Validators.lt(function(){
                    return this.schedules.$.monday.morning_end;
                })
            ]
     }

This example doesn't work because of the $, and that's the one i need to replace by the proper array index. And it does and up working if i use: return this.schedules[0].monday.morning_end Which isn't really useful...

lukejagodzinski commented 9 years ago

Hi, it was already implemented in the new version :-). So a lot of new features will appear :-)

lukejagodzinski commented 9 years ago

In closing this issue for now :-)

ghost commented 9 years ago

Awesome. Thanks ;). Will wait for this new version then.