@osovitny/anatoly 3.19.12 → 3.19.13

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -6,6 +6,7 @@ import * as i1 from '@angular/common/http';
6
6
  import { HttpResponse, HttpClient, HTTP_INTERCEPTORS, HttpClientModule } from '@angular/common/http';
7
7
  import * as i1$1 from '@angular/common';
8
8
  import { DOCUMENT, CommonModule } from '@angular/common';
9
+ import { format, formatDistance, formatDistanceToNow } from 'date-fns';
9
10
  import js_beautify from 'js-beautify';
10
11
  import * as i1$2 from '@angular/router';
11
12
  import { NavigationEnd, NavigationStart, NavigationCancel, NavigationError, RouterModule } from '@angular/router';
@@ -13,7 +14,6 @@ import { v4 } from 'uuid';
13
14
  import * as i4 from '@azure/msal-angular';
14
15
  import { MSAL_GUARD_CONFIG, MsalGuard, MsalInterceptor, MSAL_INTERCEPTOR_CONFIG, MSAL_INSTANCE, MsalService, MsalBroadcastService, MsalModule } from '@azure/msal-angular';
15
16
  import { BrowserUtils, EventType, InteractionStatus, InteractionType, InteractionRequiredAuthError, PromptValue, PublicClientApplication, LogLevel } from '@azure/msal-browser';
16
- import { format, formatDistance, formatDistanceToNow } from 'date-fns';
17
17
  import { enUS } from 'date-fns/locale/en-US';
18
18
  import * as i1$3 from '@ngx-translate/core';
19
19
  import { TranslateModule, TranslateLoader, TranslateService } from '@ngx-translate/core';
@@ -1260,19 +1260,23 @@ function isValidTimezoneIANAString(timeZoneString) {
1260
1260
  </file>
1261
1261
  */
1262
1262
  class DateConvert {
1263
- static toDate(argument) {
1264
- const argStr = Object.prototype.toString.call(argument);
1265
- if (argument instanceof Date || (typeof argument === "object" && argStr === "[object Date]")) {
1266
- return argument;
1263
+ static toDate(date) {
1264
+ const argStr = Object.prototype.toString.call(date);
1265
+ if (date instanceof Date || (typeof date === "object" && argStr === "[object Date]")) {
1266
+ return date;
1267
1267
  }
1268
- else if (typeof argument === "number" || argStr === "[object Number]" ||
1269
- typeof argument === "string" || argStr === "[object String]") {
1270
- return new Date(argument);
1268
+ else if (typeof date === "number" || argStr === "[object Number]" ||
1269
+ typeof date === "string" || argStr === "[object String]") {
1270
+ return new Date(date);
1271
1271
  }
1272
1272
  else {
1273
1273
  return new Date(NaN);
1274
1274
  }
1275
1275
  }
1276
+ static toFormattedDate(date, formatStr = 'yyyy-MM-dd HH:mm:ss') {
1277
+ const parsedDate = this.toDate(date);
1278
+ return format(parsedDate, formatStr);
1279
+ }
1276
1280
  static utcToLocal(dirtyDate) {
1277
1281
  if (typeof dirtyDate === 'string') {
1278
1282
  if (dirtyDate.indexOf("T") > -1) {