Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
fix: TT-20 Calculate Difference
  • Loading branch information
wobravo committed Apr 17, 2021
commit 46fb57e6c5f43958296a5f162c22749197c6d9a5
Original file line number Diff line number Diff line change
Expand Up @@ -137,11 +137,13 @@
</div>
</div>

<div class="form-group row">
<div class="form-group row" *ngIf="!goingToWorkOnThis">
<label class="col-12 col-sm-2">Total Hours:</label>
<div class="col-12 col-sm-4">
<span>

<span class="border-tag"
[class.border-tag--disabled]="!(project_id.value && project_name.value)"
>
{{ this.getTimeDifference() }}
</span>
</div>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -108,3 +108,10 @@ input[type="date"]::-webkit-clear-button {
background-color: #e9ecef;
opacity: 1;
}

.border-tag {
border: 1px solid $primary;
padding: 10px;
border-radius: 5px;
margin-top: 10px;
}
Original file line number Diff line number Diff line change
Expand Up @@ -131,14 +131,23 @@ export class DetailsFieldsComponent implements OnChanges, OnInit {
}

getTimeDifference(){
const horainico = this.start_hour.value;
const horafinal = this.end_hour.value;
console.log(horainico + ' ' + horafinal);
const ab = moment(horainico, 'HH:mm');
const ac = moment(horafinal, 'HH:mm');
console.error(moment.duration(ab.diff(ac)).humanize());
const diff = [moment.duration(ab.diff(ac)).humanize()];
return diff;
moment.locale('es');
const hourStart = this.start_hour.value;
const hourEnd = this.end_hour.value;
const ab = moment(hourStart, 'HH:mm');
const ac = moment(hourEnd, 'HH:mm');
if (hourStart === '00:00') {
const hourTotal = '00:00';
return hourTotal;
}
if (hourEnd === '00:00') {
const hourTotal = '00:00';
return hourTotal;
}else {
const hourTotal = [moment.duration(ab.diff(ac))];
return hourTotal;
}

}

ngOnChanges(): void {
Expand Down