From 56aeec21d2303ef286efd9fad14e711af1be9558 Mon Sep 17 00:00:00 2001 From: enadhilal Date: Tue, 31 Aug 2021 16:52:39 +0300 Subject: [PATCH] fixing date time in worklist --- .../work-list-main-itg.component.ts | 26 ++++++++++++++++- .../worklist-main-ic.component.ts | 26 ++++++++++++++++- .../worklist-main-mr.component.ts | 26 ++++++++++++++++- .../worklist-main-po.component.ts | 26 ++++++++++++++++- .../worklist-main-pr.component.ts | 26 ++++++++++++++++- .../worklist-main/worklist-main.component.ts | 28 ++++++++++++++++++- 6 files changed, 152 insertions(+), 6 deletions(-) diff --git a/Mohem/src/app/notification/work-list-main-itg/work-list-main-itg.component.ts b/Mohem/src/app/notification/work-list-main-itg/work-list-main-itg.component.ts index f10b14aa..21058cca 100644 --- a/Mohem/src/app/notification/work-list-main-itg/work-list-main-itg.component.ts +++ b/Mohem/src/app/notification/work-list-main-itg/work-list-main-itg.component.ts @@ -537,7 +537,31 @@ export class WorkListMainItgComponent implements OnInit { returnDateTime(stringDate: string){ let allDateTime = stringDate.split(' '); let time = allDateTime[1].split(':', 2); - return allDateTime[0] + ' ' + time[0] + ':' + time[1] + ' ' + allDateTime[2]; + let fullDate = this.transform(stringDate); + return fullDate + ' ' + time[0] + ':' + time[1] + ' ' + allDateTime[2]; + } + locale = { + en: { + // month_names: ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December'], + month_names_short: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'] + } +}; + transform(value: string) { + let x = new Date(Date.parse(value)); + //return value.toLowerCase(); + let month = this.getMonthNameShort('en',x.getMonth()) + return ""+ x.getDate()+" "+ month +" "+x.getFullYear(); + + + } + + + + + getMonthNameShort(lang,month) { + lang = lang && (lang in this.locale) ? lang : 'en'; + return this.locale[lang].month_names_short[month]; +}; } diff --git a/Mohem/src/app/notification/worklist-main-ic/worklist-main-ic.component.ts b/Mohem/src/app/notification/worklist-main-ic/worklist-main-ic.component.ts index d590dc23..f5c2abec 100644 --- a/Mohem/src/app/notification/worklist-main-ic/worklist-main-ic.component.ts +++ b/Mohem/src/app/notification/worklist-main-ic/worklist-main-ic.component.ts @@ -1275,7 +1275,31 @@ export class WorklistMainIcComponent implements OnInit { returnDateTime(stringDate: string){ let allDateTime = stringDate.split(' '); let time = allDateTime[1].split(':', 2); - return allDateTime[0] + ' ' + time[0] + ':' + time[1] + ' ' + allDateTime[2]; + let fullDate = this.transform(stringDate); + return fullDate + ' ' + time[0] + ':' + time[1] + ' ' + allDateTime[2]; + } + locale = { + en: { + // month_names: ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December'], + month_names_short: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'] + } +}; + transform(value: string) { + let x = new Date(Date.parse(value)); + //return value.toLowerCase(); + let month = this.getMonthNameShort('en',x.getMonth()) + return ""+ x.getDate()+" "+ month +" "+x.getFullYear(); + + + } + + + + + getMonthNameShort(lang,month) { + lang = lang && (lang in this.locale) ? lang : 'en'; + return this.locale[lang].month_names_short[month]; +}; } diff --git a/Mohem/src/app/notification/worklist-main-mr/worklist-main-mr.component.ts b/Mohem/src/app/notification/worklist-main-mr/worklist-main-mr.component.ts index bcf11eb4..c64765f5 100644 --- a/Mohem/src/app/notification/worklist-main-mr/worklist-main-mr.component.ts +++ b/Mohem/src/app/notification/worklist-main-mr/worklist-main-mr.component.ts @@ -1221,8 +1221,32 @@ export class WorklistMainMRComponent implements OnInit { returnDateTime(stringDate: string){ let allDateTime = stringDate.split(' '); let time = allDateTime[1].split(':', 2); - return allDateTime[0] + ' ' + time[0] + ':' + time[1] + ' ' + allDateTime[2]; + let fullDate = this.transform(stringDate); + return fullDate + ' ' + time[0] + ':' + time[1] + ' ' + allDateTime[2]; + } + locale = { + en: { + // month_names: ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December'], + month_names_short: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'] + } +}; + transform(value: string) { + let x = new Date(Date.parse(value)); + //return value.toLowerCase(); + let month = this.getMonthNameShort('en',x.getMonth()) + return ""+ x.getDate()+" "+ month +" "+x.getFullYear(); + + + } + + + + + getMonthNameShort(lang,month) { + lang = lang && (lang in this.locale) ? lang : 'en'; + return this.locale[lang].month_names_short[month]; +}; } diff --git a/Mohem/src/app/notification/worklist-main-po/worklist-main-po.component.ts b/Mohem/src/app/notification/worklist-main-po/worklist-main-po.component.ts index 7972c17d..844f3af6 100644 --- a/Mohem/src/app/notification/worklist-main-po/worklist-main-po.component.ts +++ b/Mohem/src/app/notification/worklist-main-po/worklist-main-po.component.ts @@ -1253,6 +1253,30 @@ export class WorklistMainPoComponent implements OnInit { returnDateTime(stringDate: string){ let allDateTime = stringDate.split(' '); let time = allDateTime[1].split(':', 2); - return allDateTime[0] + ' ' + time[0] + ':' + time[1] + ' ' + allDateTime[2]; + let fullDate = this.transform(stringDate); + return fullDate + ' ' + time[0] + ':' + time[1] + ' ' + allDateTime[2]; + } + locale = { + en: { + // month_names: ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December'], + month_names_short: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'] + } +}; + transform(value: string) { + let x = new Date(Date.parse(value)); + //return value.toLowerCase(); + let month = this.getMonthNameShort('en',x.getMonth()) + return ""+ x.getDate()+" "+ month +" "+x.getFullYear(); + + + } + + + + + getMonthNameShort(lang,month) { + lang = lang && (lang in this.locale) ? lang : 'en'; + return this.locale[lang].month_names_short[month]; +}; } diff --git a/Mohem/src/app/notification/worklist-main-pr/worklist-main-pr.component.ts b/Mohem/src/app/notification/worklist-main-pr/worklist-main-pr.component.ts index a71e0492..83f68c84 100644 --- a/Mohem/src/app/notification/worklist-main-pr/worklist-main-pr.component.ts +++ b/Mohem/src/app/notification/worklist-main-pr/worklist-main-pr.component.ts @@ -1175,6 +1175,30 @@ export class WorklistMainPRComponent implements OnInit { returnDateTime(stringDate: string){ let allDateTime = stringDate.split(' '); let time = allDateTime[1].split(':', 2); - return allDateTime[0] + ' ' + time[0] + ':' + time[1] + ' ' + allDateTime[2]; + let fullDate = this.transform(stringDate); + return fullDate + ' ' + time[0] + ':' + time[1] + ' ' + allDateTime[2]; + } + locale = { + en: { + // month_names: ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December'], + month_names_short: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'] + } +}; + transform(value: string) { + let x = new Date(Date.parse(value)); + //return value.toLowerCase(); + let month = this.getMonthNameShort('en',x.getMonth()) + return ""+ x.getDate()+" "+ month +" "+x.getFullYear(); + + + } + + + + + getMonthNameShort(lang,month) { + lang = lang && (lang in this.locale) ? lang : 'en'; + return this.locale[lang].month_names_short[month]; +}; } \ No newline at end of file diff --git a/Mohem/src/app/notification/worklist-main/worklist-main.component.ts b/Mohem/src/app/notification/worklist-main/worklist-main.component.ts index ac9e5438..ac841be6 100644 --- a/Mohem/src/app/notification/worklist-main/worklist-main.component.ts +++ b/Mohem/src/app/notification/worklist-main/worklist-main.component.ts @@ -1088,9 +1088,35 @@ export class WorklistMainComponent implements OnInit { } console.log(this.arr_hr_req_only); } + returnDateTime(stringDate: string){ let allDateTime = stringDate.split(' '); let time = allDateTime[1].split(':', 2); - return allDateTime[0] + ' ' + time[0] + ':' + time[1] + ' ' + allDateTime[2]; + let fullDate = this.transform(stringDate); + return fullDate + ' ' + time[0] + ':' + time[1] + ' ' + allDateTime[2]; + + } + locale = { + en: { + // month_names: ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December'], + month_names_short: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'] + } +}; + transform(value: string) { + let x = new Date(Date.parse(value)); + //return value.toLowerCase(); + let month = this.getMonthNameShort('en',x.getMonth()) + return ""+ x.getDate()+" "+ month +" "+x.getFullYear(); + + } + + + + + getMonthNameShort(lang,month) { + lang = lang && (lang in this.locale) ? lang : 'en'; + return this.locale[lang].month_names_short[month]; +}; + }