Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug/cstm cpc 1014 fix pet date and update pet form #588

Merged
merged 14 commits into from
Oct 23, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
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
Original file line number Diff line number Diff line change
Expand Up @@ -32,12 +32,14 @@
};*/


vm.getBirthday = function(birthday) {

Check notice on line 35 in api-gateway/src/main/resources/static/scripts/owner-details/owner-details.controller.js

View workflow job for this annotation

GitHub Actions / Qodana for JVM

Duplicated code fragment

Duplicated code
if (birthday) {
var date = new Date(birthday);
var year = date.getUTCFullYear();
var month = (date.getUTCMonth() + 1).toString().padStart(2, '0'); // Months are zero-based, so we add 1
var day = date.getUTCDate().toString().padStart(2, '0');
var timezoneOffset = date.getTimezoneOffset() * 60000;
date = new Date(date.getTime() - timezoneOffset);
var year = date.getFullYear();
var month = (date.getMonth() + 1).toString().padStart(2, '0'); // Months are zero-based, so we add 1
var day = date.getDate().toString().padStart(2, '0');
return year + ' / ' + month + ' / ' + day;
} else {
return '';
Expand Down Expand Up @@ -116,7 +118,7 @@
vm.toggleActiveStatus = function (petId) {
return $http.get('api/gateway/pets/' + petId + '?_=' + new Date().getTime(), {headers: {'Cache-Control': 'no-cache'}})
.then(function (resp) {
console.log("Pet id is " + petId);

Check notice on line 121 in api-gateway/src/main/resources/static/scripts/owner-details/owner-details.controller.js

View workflow job for this annotation

GitHub Actions / Qodana for JVM

Duplicated code fragment

Duplicated code
console.log(resp.data);
vm.pet = resp.data;
console.log("Pet id is " + vm.pet.petId);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,11 @@ function PetDetailsController($http, $state, $stateParams, $scope, $timeout, $q)
vm.getBirthday = function(birthday) {
if (birthday) {
var date = new Date(birthday);
var year = date.getUTCFullYear();
var month = (date.getUTCMonth() + 1).toString().padStart(2, '0'); // Months are zero-based, so we add 1
var day = date.getUTCDate().toString().padStart(2, '0');
var timezoneOffset = date.getTimezoneOffset() * 60000;
date = new Date(date.getTime() - timezoneOffset);
var year = date.getFullYear();
var month = (date.getMonth() + 1).toString().padStart(2, '0'); // Months are zero-based, so we add 1
var day = date.getDate().toString().padStart(2, '0');
return year + ' / ' + month + ' / ' + day;
} else {
return '';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ angular.module('petForm')
"Pet Birth Date: " + formattedBirthDate + "\n" +
"Weight: " + self.pet.weight + " KG" + "\n" +
"Pet Type: " + petTypeName)) {

var data = {
petId: self.pet.petId,
name: self.pet.name,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<div class="bColor"><h2 class="titleOwner form">Pet</h2></div>
<div class="bColor"><h2 class="titleOwner form">Edit Pet</h2></div>

<form id="petForm" class="form-horizontal" ng-submit="$ctrl.submit()">
<div class="form-group formColor">
Expand Down
Loading