我試圖做一個基於時間差異和日期差異的應用程序,並且日期和時間都是由用戶輸入的,並且時間格式都是在24小時內的情況。當我嘗試減去這些值時錯誤的答案。如何區分angularjs中的兩個時間值和日期值?
<html>
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.4.8/angular.min.js"></script>
<body>
<div ng-app="">
Time1:<br><input type="text" pattern="([0-1]{1}[0-9]{1}|20|21|22|23):[0-5]{1}[0-9]{1}" ng-model="time1"><br>
<br>
Time2:<br><input type="text" pattern="([0-1]{1}[0-9]{1}|20|21|22|23):[0-5]{1}[0-9]{1}" ng-model="time2">
<p> Your Time is ans is{{time1-time2}} </p>
</div>
</body>
</html>
請顯示相關代碼。 –
對不起,現在代碼已經插入在html中。 – Anshuman