Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/470.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 两次验证之间的角度过滤器不工作?_Javascript_Jquery_Angularjs - Fatal编程技术网

Javascript 两次验证之间的角度过滤器不工作?

Javascript 两次验证之间的角度过滤器不工作?,javascript,jquery,angularjs,Javascript,Jquery,Angularjs,我已经添加了我的完整代码。在这里,用户选择的日期是星期三(2015年12月2日星期三),时间是晚上9:00。如果我在星期三开门和关门时间(上午9:10-下午6:30)与店铺联系。在这里,当我单击“订单”按钮时,它应该显示店铺现在关门,而不是显示店铺现在开门 这里是am计时,如果时间是pm,一切都正常,这意味着它总是显示商店现在开门了。有人帮我吗 检查以下条件 var d=“Wed Dec 02 2015 09:00 PM”-现在应该显示关闭 var d=“Wed Dec 02 2015 06:4

我已经添加了我的完整代码。在这里,用户选择的日期是星期三(2015年12月2日星期三),时间是晚上9:00。如果我在星期三开门和关门时间(上午9:10-下午6:30)与店铺联系。在这里,当我单击“订单”按钮时,它应该显示店铺现在关门,而不是显示店铺现在开门

这里是am计时,如果时间是pm,一切都正常,这意味着它总是显示商店现在开门了。有人帮我吗 检查以下条件

var d=“Wed Dec 02 2015 09:00 PM”-现在应该显示关闭

var d=“Wed Dec 02 2015 06:40 PM”-现在应该显示已关闭

var d=“Wed Dec 02 2015 09:00 AM”-它现在应该显示为closed(工作正常)

var d=“2015年12月2日星期三上午10:00”-它应该显示现在已打开(工作正常)

angular.module('myApp',[])
.controller(“myCntrl”,函数($scope,$filter){
$scope.isOpen=函数(dealerSchedule){
var d=“2015年12月2日星期三晚上09:00”,
日期=新日期(d),
times=dealerSchedule[Object.keys(dealerSchedule)[date.getDay()-1]]拆分(“-”),
startTime=新日期(Date.getFullYear()+“/”+(Date.getMonth()+1)+“/”+Date.getDate()+”+次[0]),
endTime=新日期(Date.getFullYear()+“/”+(Date.getMonth()+1)+“/”+Date.getDate()+”+次[1]),
响应=错误;
日期=$scope.convertToUTC(日期);
startTime=$scope.convertToUTC(startTime);
endtime=$scope.convertToUTC(endtime);
响应=开始时间=日期;
如果(答复){
警惕(‘店铺现已开业’);
}否则{
警报(“对不起,商店关门了”);
}
};
$scope.convertToUTC=函数(日期){
返回新日期(Date.getUTCFullYear(),Date.getUTCMonth(),Date.getUTCDate(),Date.getUTCHours(),Date.getUTCMinutes(),Date.getUTCSeconds());
}
$scope.dealers=[{
S_电子邮件\u id:“aditiya@gmail.com",
S_商店:“三星”,
地位:“,
门店名称:“Adtiya三星店”,
S_服务:“常规服务、软件故障、硬件故障”,
门店描述:“承接各类三星手机”,
门店简介:“承接各类三星手机”,
日期:{
“星期一”:“上午09:10-下午06:30”,
“星期二”:“上午09:10-下午12:00”,
“星期三”:“上午09:10-下午06:30”,
“星期四”:“上午09:10-下午06:30”,
“星期五”:“上午09:10-下午06:30”,
“星期六”:“上午10:15-下午4:15”,
“星期日”:“上午10:15-下午4:15”
},
},  ]
//变量日期=新日期();
//$scope.hhmmststt=$filter('date')(新日期(),'hh:mm:ss a');
//log($scope.hhmmstt);
})

在标签上搜索



{{经销商.商店名称}
{{dealer.S_Email_id}
星期三:{{经销商日.星期三}




这是一种解决方案,您无需将时间转换为UTC进行通信……)


在标签上搜索



{{经销商.商店名称}
{{dealer.S_Email_id}
星期三:{{经销商日.星期三}



angular.module('myApp',[]) .controller(“myCntrl”,函数($scope,$filter){ $scope.isOpen=函数(dealerSchedule){ var d=“2015年12月2日星期三晚上09:00”, 日期=新日期(d), times=dealerSchedule[Object.keys(dealerSchedule)[date.getDay()-1]]拆分(“-”), startTime=新日期(Date.getFullYear()+“/”+(Date.getMonth()+1)+“/”+Date.getDate()+”+次[0]), endTime=新日期(Date.getFullYear()+“/”+(Date.getMonth()+1)+“/”+Date.getDate()+”+次[1]), 响应=错误; console.log(endTime+entime); console.log(开始时间+“开始时间”,日期) 响应=开始时间=日期; 如果(答复){ 警惕(‘店铺现已开业’); }否则{ 警报(“对不起,商店关门了”); } }; $scope.convertToUTC=函数(日期){ 返回新日期(Date.getUTCFullYear(),Date.getUTCMonth(),Date.getUTCDate(),Date.getUTCHours(),Date.getUTCMinutes(),Date.getUTCSeconds()); } $scope.dealers=[{ S_电子邮件\u id:“aditiya@gmail.com", S_商店:“三星”, 地位:“, 门店名称:“Adtiya三星店”, S_服务:“常规服务、软件故障、硬件故障”, 门店描述:“承接各类三星手机”, 门店简介:“承接各类三星手机”, 日期:{ “星期一”:“上午09:10-下午06:30”, “星期二”:“上午09:10-下午12:00”, “星期三”:“上午09:10-下午06:30”, “星期四”:“上午09:10-下午06:30”, “星期五”:“上午09:10-下午06:30”, “星期六”:“上午10:15-下午4:15”, “星期日”:“上午10:15-下午4:15” }, }, ] //变量日期=新日期(); //$scope.hhmmststt=$filter('date')(新日期(),'hh:mm:ss a'); //log($scope.hhmmstt); })
这是一种解决方案,您无需将时间转换为UTC进行通信……)

        <html>
            <head>
            <script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.2.23/angular.min.js"></script>
            </head>
            <body>
            <div ng-app="myApp">
              <div ng-controller="myCntrl">
                <label>Search on Label</label>
                <br>
                <input ng-model="query" type="text" placeholder="Search for name" />
                <br>
                <br>

                <div ng-repeat="dealer in dealers">

                  {{dealer.Store_Name}}
                  <br>{{dealer.S_Email_id}}
                  <br>wednesday :{{dealer.Day.wednesday}}
                  <br>
                  <input type="button" value="order" ng-click="isOpen(dealer.Day)"/>

                  <br>
                  <br>
                  <br>

                </div>

              </div>
            </div>
            <script>
            angular.module('myApp', [])
              .controller("myCntrl", function($scope, $filter) {

                $scope.isOpen = function(dealerSchedule) {

                    var d = "Wed Dec 02 2015 09:00 PM",
                    date = new Date(d),
                    times = dealerSchedule[Object.keys(dealerSchedule)[date.getDay() - 1]].split(" - "),


                startTime = new Date(date.getFullYear() + "/" + (date.getMonth() + 1) + "/" + date.getDate() + " " + times[0]),
                endTime = new Date(date.getFullYear() + "/" + (date.getMonth() + 1) + "/" + date.getDate() + " " + times[1]),
                response = false;

                    console.log(endTime+"entime");
                    console.log(startTime+"statrt",date)

                  response = startTime <= date && endTime >= date;
                  if(response){
                alert('shop opened now'); 
                      }else{
                      alert('sorry shop closed');
                    }
                };

              $scope.convertToUTC = function(date){
                return new Date(date.getUTCFullYear(), date.getUTCMonth(), date.getUTCDate(),  date.getUTCHours(), date.getUTCMinutes(), date.getUTCSeconds());
              }


                $scope.dealers = [{

                   S_Email_id: "aditiya@gmail.com",
                S_Store: "samsung",
                status:"",
                Store_Name: "Adtiya Samsung Store",
                S_Services: "Regular Service,Software Faults,Hardware Faults",
                Store_long_description: "Undertake all kind of samsung mobiles",
                Store_short_description: "Undertake all kind of samsung mobiles",
                  Day: {
                "monday": "09:10 AM - 06:30 PM",
                "tuesday": "09:10 AM - 12:00 PM",
                "wednesday": "09:10 AM - 06:30 PM",
                "thursday": "09:10 AM - 06:30 PM",
                "friday": "09:10 AM - 06:30 PM",
                "saturday": "10:15 AM - 04:15 PM",
                "sunday": "10:15 AM - 04:15 PM"
                  },
                },  ]
                //var date = new Date();

                //$scope.hhmmsstt = $filter('date')(new Date(), 'hh:mm:ss a');
                //console.log($scope.hhmmsstt);
              })
            </script>
            </body>

            </html>