【发布时间】:2017-11-22 14:12:42
【问题描述】:
我想根据外出时间和时间的差异计算 ot 小时。我想知道使用角度 js 实现它的可能方法。重要的是我需要它以小时:分钟:秒格式。以下是示例我的代码。
我的看法
<table class="row-border hover table table-bordered cb-data-table">
<tr>
<th>In Time</th>
<th>Out Time</th>
<th>OT Hours</th>
</tr>
<tr ng-show="!dailyAttendances.length">
<td colspan="3" style="text-align: center">~ No Any Records ~</td>
</tr>
<tr ng-repeat="dailyAttendance in dailyAttendances" >
<td>@{{ dailyAttendance.in_time}}</td>
<td>@{{ dailyAttendance.out_time}}</td>
<td></td>
</tr>
</table>
我的 javascript 文件
$scope.loadAllDailyAttendance = function () {
$scope.dailyAttendances = {};
$http({
method: "GET",
url: "/attendance/loadAllDailyAttendance",
headers: {
'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')
},
}).then(function successCallback(response) {
$scope.dailyAttendances = response.data;
console.log(response.data);
}, function errorCallback(response) {
});
};
【问题讨论】:
-
你怎么知道是上午还是下午?
-
{{dailyAttendance.out_time - regular_office_end_time}} -
@shihas 它不起作用我已经尝试过了。@ramesh in_time 始终是 AM。
标签: javascript php angularjs laravel