remove all date

This commit is contained in:
Peter Maquiran
2023-03-09 15:15:06 +01:00
parent 9253c33f08
commit 0b4cafda22
5 changed files with 117 additions and 13 deletions
+63 -4
View File
@@ -1,4 +1,4 @@
import { Component, OnInit } from '@angular/core';
import { Component, OnInit, ViewChild } from '@angular/core';
import { ModalController, NavParams } from '@ionic/angular';
import { SearchService } from "../../services/search.service";
import { formatDate } from '@angular/common';
@@ -14,14 +14,40 @@ import { ViewDocumentPage } from 'src/app/modals/view-document/view-document.pag
import { Router } from '@angular/router';
import { environment } from 'src/environments/environment';
import { HttpErrorHandle } from 'src/app/services/http-error-handle.service';
import { NGX_MAT_DATE_FORMATS } from '@angular-material-components/datetime-picker';
import { NgxMatDateFormats } from '@angular-material-components/datetime-picker';
const CUSTOM_DATE_FORMATS: NgxMatDateFormats = {
parse: {
dateInput: "YYYY-MMMM-DD HH:mm"
},
display: {
dateInput: "DD MMM YYYY H:mm",
monthYearLabel: "MMM YYYY",
dateA11yLabel: "LL",
monthYearA11yLabel: "MMMM YYYY"
}
}
@Component({
selector: 'app-search',
templateUrl: './search.page.html',
styleUrls: ['./search.page.scss'],
providers: [
{ provide: NGX_MAT_DATE_FORMATS, useValue: CUSTOM_DATE_FORMATS },
]
})
export class SearchPage implements OnInit {
public showSpinners = true;
public showSeconds = false;
public touchUi = false;
public enableMeridian = false;
public stepHour = 1;
public stepMinute = 15;
public stepSecond = 15;
//
// https params
searchSubject: string;
searchDocumentDate: string;
@@ -61,6 +87,9 @@ export class SearchPage implements OnInit {
showSearchInput = false
@ViewChild('picker1') picker1: any;
constructor(private modalController: ModalController,
private search: SearchService,
private modalCtrl: ModalController,
@@ -213,6 +242,38 @@ export class SearchPage implements OnInit {
}
roundTimeQuarterHour(timeToReturn = new Date()) {
let date: any = new Date(timeToReturn) || new Date();
const minutes = date.getMinutes();
date.setSeconds(0);
if(minutes % 15 != 0) {
if (minutes > 45) {
date.setMinutes(60)
} else if (minutes > 30) {
date.setMinutes(45)
} else if (minutes > 15) {
date.setMinutes(30)
} else if (minutes > 0) {
date.setMinutes(15)
}
}
return date
}
clickDate() {
if(!this.searchDocumentDate) {
this.searchDocumentDate = this.roundTimeQuarterHour()
}
}
clearInputDocumentDate() {
this.searchDocumentDate = "";
}
loadWordCloud() {
setTimeout(() => {
@@ -720,9 +781,7 @@ export class SearchPage implements OnInit {
this.searchSender = "";
}
clearInputDocumentDate(){
this.searchDocumentDate = "";
}
clearInputOrganicEntity(){
this.searchOrganicEntiry = "";