correction de bugs pour l'affichage ou la maj de la date et heure

This commit is contained in:
2023-01-02 19:16:48 +01:00
parent 83941978f3
commit 05a51f0a12
4 changed files with 6 additions and 5 deletions

View File

@@ -37,7 +37,7 @@ export class DatetimeComponent implements OnInit {
dateChanged(event:MatDatepickerInputEvent<Date>): void { dateChanged(event:MatDatepickerInputEvent<Date>): void {
var date = moment(event.value); var date = moment(event.value);
this.date = date.format("DD/MM/YYYY").toString(); this.date = date.format("YYYY-MM-DD").toString();
if(this.time && this.date) { if(this.time && this.date) {
this.isDisabled = false; this.isDisabled = false;
} }
@@ -61,9 +61,9 @@ export class DatetimeComponent implements OnInit {
onUpdate(): void { onUpdate(): void {
this.setTimeoutDisabledButton(5); this.setTimeoutDisabledButton(5);
var newDateTime:string = this.date + " " + this.time; var newDateTime:string = this.date + " " + this.time + ":00";
console.log("Nouvelle date et heure: ", newDateTime); console.log("Nouvelle date et heure: ", newDateTime);
this.bs.updateDatetime(newDateTime).subscribe( this.bs.updateDatetime({'datetime':newDateTime}).subscribe(
data => { data => {
this.toast.success("Mise à jour de la date et heure réussie"); this.toast.success("Mise à jour de la date et heure réussie");
}, err => { }, err => {

View File

@@ -13,7 +13,7 @@
<div style="display: grid; align-items: center;">{{today | date:'dd/MM/yyyy HH:mm:ss'}}</div> <div style="display: grid; align-items: center;">{{today | date:'dd/MM/yyyy HH:mm:ss'}}</div>
</div> </div>
<div fxLayout="row" style="width:100%; margin-bottom: 0.25rem;"> <div fxLayout="row" style="width:100%; margin-bottom: 0.25rem;">
<span fxFlex="50" style="display: grid; align-items: center;"><b>RTC:</b></span> <span fxFlex="50" style="display: grid; align-items: center;"><b>Horloge matérielle:</b></span>
<div *ngIf="RTCisAlive" style="display: grid; align-items: center;"><mat-icon style="color: green;">check_circle</mat-icon></div> <div *ngIf="RTCisAlive" style="display: grid; align-items: center;"><mat-icon style="color: green;">check_circle</mat-icon></div>
<div *ngIf="!RTCisAlive" style="display: grid; align-items: center;"><mat-icon style="color: red;">cancel</mat-icon></div> <div *ngIf="!RTCisAlive" style="display: grid; align-items: center;"><mat-icon style="color: red;">cancel</mat-icon></div>
</div> </div>

View File

@@ -68,6 +68,7 @@ export class InfosComponent implements OnInit {
this.isAlive = data['alive']; this.isAlive = data['alive'];
this.bs.RTCAlive().subscribe( this.bs.RTCAlive().subscribe(
data => { data => {
this.RTCisAlive = data['RTCalive'];
this.isProcessing = false; this.isProcessing = false;
}, err => { }, err => {
if(err.status == 401) { if(err.status == 401) {

View File

@@ -183,7 +183,7 @@ export class BackendService {
return this.http.post<any>(host+"/api/configurateur/shutdown", {}, options); return this.http.post<any>(host+"/api/configurateur/shutdown", {}, options);
} }
updateDatetime(val:string):Observable<any> { updateDatetime(val:any):Observable<any> {
let host=environment.host; let host=environment.host;
const options = { const options = {
headers: new HttpHeaders({ headers: new HttpHeaders({