ripdog / booking-meteor

A simple booking app for Meteor.js
Apache License 2.0
18 stars 4 forks source link

Server-based appointment date max/min checking appears to fail when timezone doesnt match client timezone. #17

Open ripdog opened 10 years ago

ripdog commented 10 years ago

regarding

            var cleanDate = moment(this.value).startOf('day');
            var provObject = unusualDays.findOne({date: cleanDate, providerID: this.field("providerID").value});
            if (typeof provObject === "undefined") {
                provObject = providers.findOne(this.field("providerID").value);
            }
            //this may fail due to timezone? try on nz timezone server.
            if(moment(this.value).isValid() === false) {
                return "wtf"
            }

            else if (moment(this.value).isBefore(cleanDate.zone(-12).hours(provObject.startTime).utc())) {
                return "minDate"
            }
            else if (moment(this.value).isAfter(cleanDate.zone(-12).hours(provObject.endTime).utc())) {
                return "maxDate"
            }