Files
flights_web_raw/apps/angular/node_modules/.cache/babel-webpack/07a2442e46f2cfb18b348c94c577fb29.json
T

1 line
8.0 KiB
JSON

{"ast":null,"code":"import _asyncToGenerator from \"/Users/gnezim/_projects/tims/flights_web_raw/Aeroflot.Flights.Web/apps/angular/node_modules/@babel/runtime/helpers/esm/asyncToGenerator\";\nimport { first } from 'rxjs/operators';\nimport * as i0 from \"@angular/core\";\nimport * as i1 from \"@ngx-translate/core\";\nexport class DatesTranslationService {\n constructor(translateService) {\n this.translateService = translateService;\n this.monthsNames = {};\n this.monthsFullNames = {};\n this.initialized = false;\n }\n\n getTranslations() {\n return this.translateService.get(['MONTH-SHORT.1', 'MONTH-SHORT.2', 'MONTH-SHORT.3', 'MONTH-SHORT.4', 'MONTH-SHORT.5', 'MONTH-SHORT.6', 'MONTH-SHORT.7', 'MONTH-SHORT.8', 'MONTH-SHORT.9', 'MONTH-SHORT.10', 'MONTH-SHORT.11', 'MONTH-SHORT.12', 'OF-MONTH.1', 'OF-MONTH.2', 'OF-MONTH.3', 'OF-MONTH.4', 'OF-MONTH.5', 'OF-MONTH.6', 'OF-MONTH.7', 'OF-MONTH.8', 'OF-MONTH.9', 'OF-MONTH.10', 'OF-MONTH.11', 'OF-MONTH.12']).pipe(first()).toPromise();\n }\n\n init() {\n var _this = this;\n\n return _asyncToGenerator(function* () {\n if (_this.initialized) {\n return Promise.resolve(true);\n }\n\n const values = yield _this.getTranslations();\n\n for (let i = 0; i < 12; i++) {\n const shortNameKey = `MONTH-SHORT.${i + 1}`;\n const fullNameKey = `OF-MONTH.${i + 1}`;\n _this.monthsNames[i] = values[shortNameKey];\n _this.monthsFullNames[i] = values[fullNameKey];\n }\n\n _this.initialized = true;\n return Promise.resolve(true);\n })();\n }\n\n getMonthName(monthNumber) {\n return this.monthsNames[monthNumber];\n }\n\n getMonthFullName(monthNumber) {\n return this.monthsFullNames[monthNumber];\n }\n\n getShortDateString(date) {\n return `${date.getDate()} ${this.getMonthName(date.getMonth())}`;\n }\n\n getFullDateString(date, withYear = false) {\n const paddedDate = `0${date.getDate()}`.slice(-2);\n const monthName = this.getMonthFullName(date.getMonth());\n return withYear ? `${paddedDate} ${monthName} ${date.getFullYear()}` : `${paddedDate} ${monthName}`;\n }\n\n}\n\nDatesTranslationService.ɵfac = function DatesTranslationService_Factory(t) {\n return new (t || DatesTranslationService)(i0.ɵɵinject(i1.TranslateService));\n};\n\nDatesTranslationService.ɵprov = /*@__PURE__*/i0.ɵɵdefineInjectable({\n token: DatesTranslationService,\n factory: DatesTranslationService.ɵfac,\n providedIn: 'root'\n});","map":{"version":3,"sources":["/Users/gnezim/_projects/tims/flights_web_raw/Aeroflot.Flights.Web/apps/angular/src/app/shared/services/dates-translation.service.ts"],"names":["first","i0","i1","DatesTranslationService","constructor","translateService","monthsNames","monthsFullNames","initialized","getTranslations","get","pipe","toPromise","init","Promise","resolve","values","i","shortNameKey","fullNameKey","getMonthName","monthNumber","getMonthFullName","getShortDateString","date","getDate","getMonth","getFullDateString","withYear","paddedDate","slice","monthName","getFullYear","ɵfac","DatesTranslationService_Factory","t","ɵɵinject","TranslateService","ɵprov","ɵɵdefineInjectable","token","factory","providedIn"],"mappings":";AAAA,SAASA,KAAT,QAAsB,gBAAtB;AACA,OAAO,KAAKC,EAAZ,MAAoB,eAApB;AACA,OAAO,KAAKC,EAAZ,MAAoB,qBAApB;AACA,OAAO,MAAMC,uBAAN,CAA8B;AACjCC,EAAAA,WAAW,CAACC,gBAAD,EAAmB;AAC1B,SAAKA,gBAAL,GAAwBA,gBAAxB;AACA,SAAKC,WAAL,GAAmB,EAAnB;AACA,SAAKC,eAAL,GAAuB,EAAvB;AACA,SAAKC,WAAL,GAAmB,KAAnB;AACH;;AACDC,EAAAA,eAAe,GAAG;AACd,WAAO,KAAKJ,gBAAL,CACFK,GADE,CACE,CACL,eADK,EAEL,eAFK,EAGL,eAHK,EAIL,eAJK,EAKL,eALK,EAML,eANK,EAOL,eAPK,EAQL,eARK,EASL,eATK,EAUL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E,QAAL,EAAlB,CAAmC,EAA/D;AACH;;AACDC,EAAAA,iBAAiB,CAACH,IAAD,EAAOI,QAAQ,GAAG,KAAlB,EAAyB;AACtC,UAAMC,UAAU,GAAI,IAAGL,IAAI,CAACC,OAAL,EAAe,EAAnB,CAAqBK,KAArB,CAA2B,CAAC,CAA5B,CAAnB;AACA,UAAMC,SAAS,GAAG,KAAKT,gBAAL,CAAsBE,IAAI,CAACE,QAAL,EAAtB,CAAlB;AACA,WAAOE,QAAQ,GACR,GAAEC,UAAW,IAAGE,SAAU,IAAGP,IAAI,CAACQ,WAAL,EAAmB,EADxC,GAER,GAAEH,UAAW,IAAGE,SAAU,EAFjC;AAGH;;AAnEgC;;AAqErC5B,uBAAuB,CAAC8B,IAAxB,GAA+B,SAASC,+BAAT,CAAyCC,CAAzC,EAA4C;AAAE,SAAO,KAAKA,CAAC,IAAIhC,uBAAV,EAAmCF,EAAE,CAACmC,QAAH,CAAYlC,EAAE,CAACmC,gBAAf,CAAnC,CAAP;AAA8E,CAA3J;;AACAlC,uBAAuB,CAACmC,KAAxB,GAAgC,aAAcrC,EAAE,CAACsC,kBAAH,CAAsB;AAAEC,EAAAA,KAAK,EAAErC,uBAAT;AAAkCsC,EAAAA,OAAO,EAAEtC,uBAAuB,CAAC8B,IAAnE;AAAyES,EAAAA,UAAU,EAAE;AAArF,CAAtB,CAA9C","sourcesContent":["import { first } from 'rxjs/operators';\nimport * as i0 from \"@angular/core\";\nimport * as i1 from \"@ngx-translate/core\";\nexport class DatesTranslationService {\n constructor(translateService) {\n this.translateService = translateService;\n this.monthsNames = {};\n this.monthsFullNames = {};\n this.initialized = false;\n }\n getTranslations() {\n return this.translateService\n .get([\n 'MONTH-SHORT.1',\n 'MONTH-SHORT.2',\n 'MONTH-SHORT.3',\n 'MONTH-SHORT.4',\n 'MONTH-SHORT.5',\n 'MONTH-SHORT.6',\n 'MONTH-SHORT.7',\n 'MONTH-SHORT.8',\n 'MONTH-SHORT.9',\n 'MONTH-SHORT.10',\n 'MONTH-SHORT.11',\n 'MONTH-SHORT.12',\n 'OF-MONTH.1',\n 'OF-MONTH.2',\n 'OF-MONTH.3',\n 'OF-MONTH.4',\n 'OF-MONTH.5',\n 'OF-MONTH.6',\n 'OF-MONTH.7',\n 'OF-MONTH.8',\n 'OF-MONTH.9',\n 'OF-MONTH.10',\n 'OF-MONTH.11',\n 'OF-MONTH.12',\n ])\n .pipe(first())\n .toPromise();\n }\n async init() {\n if (this.initialized) {\n return Promise.resolve(true);\n }\n const values = await this.getTranslations();\n for (let i = 0; i < 12; i++) {\n const shortNameKey = `MONTH-SHORT.${i + 1}`;\n const fullNameKey = `OF-MONTH.${i + 1}`;\n this.monthsNames[i] = values[shortNameKey];\n this.monthsFullNames[i] = values[fullNameKey];\n }\n this.initialized = true;\n return Promise.resolve(true);\n }\n getMonthName(monthNumber) {\n return this.monthsNames[monthNumber];\n }\n getMonthFullName(monthNumber) {\n return this.monthsFullNames[monthNumber];\n }\n getShortDateString(date) {\n return `${date.getDate()} ${this.getMonthName(date.getMonth())}`;\n }\n getFullDateString(date, withYear = false) {\n const paddedDate = `0${date.getDate()}`.slice(-2);\n const monthName = this.getMonthFullName(date.getMonth());\n return withYear\n ? `${paddedDate} ${monthName} ${date.getFullYear()}`\n : `${paddedDate} ${monthName}`;\n }\n}\nDatesTranslationService.ɵfac = function DatesTranslationService_Factory(t) { return new (t || DatesTranslationService)(i0.ɵɵinject(i1.TranslateService)); };\nDatesTranslationService.ɵprov = /*@__PURE__*/ i0.ɵɵdefineInjectable({ token: DatesTranslationService, factory: DatesTranslationService.ɵfac, providedIn: 'root' });\n"]},"metadata":{},"sourceType":"module"}