@osovitny/anatoly 2.0.43 → 2.0.45

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.
@@ -729,6 +729,37 @@
729
729
  }
730
730
  return "Invalid Date";
731
731
  };
732
+ LocalizationService.prototype.getLocalizedDistanceInWords = function (endedDate, startedDate) {
733
+ if (dateFns.isValid(new Date(endedDate)) && dateFns.isValid(new Date(startedDate))) {
734
+ return dateFns.formatDistance(new Date(endedDate), new Date(startedDate), this.dateFnsLocale);
735
+ }
736
+ return "Invalid Date";
737
+ };
738
+ LocalizationService.prototype.getLocalizedDistanceToNowInWords = function (date) {
739
+ if (dateFns.isValid(new Date(date))) {
740
+ return dateFns.formatDistanceToNow(new Date(date), this.dateFnsLocale);
741
+ }
742
+ return "Invalid Date";
743
+ };
744
+ //UTC Operations --------------------------------------------------------------
745
+ LocalizationService.prototype.getUTCToLocalizedDate = function (key) {
746
+ var browserTimeZone = Intl.DateTimeFormat().resolvedOptions().timeZone;
747
+ if (key) {
748
+ if (key.indexOf("T") == -1) {
749
+ key = key.replace(" ", "T");
750
+ }
751
+ if (key.indexOf("Z") == -1) {
752
+ key = key + "Z";
753
+ }
754
+ }
755
+ if (browserTimeZone) {
756
+ var localDateTime = dateFnsTz.utcToZonedTime(key, browserTimeZone);
757
+ return dateFns.format(localDateTime, 'dd.MM.yyyy', this.dateFnsLocale);
758
+ }
759
+ else {
760
+ return dateFns.format(new Date(key), 'dd.MM.yyyy', this.dateFnsLocale);
761
+ }
762
+ };
732
763
  LocalizationService.prototype.getUTCToLocalizedDateTime = function (key) {
733
764
  var browserTimeZone = Intl.DateTimeFormat().resolvedOptions().timeZone;
734
765
  if (key) {
@@ -755,18 +786,6 @@
755
786
  }
756
787
  return "Invalid Date";
757
788
  };
758
- LocalizationService.prototype.getLocalizedDistanceToNowInWords = function (date) {
759
- if (dateFns.isValid(new Date(date))) {
760
- return dateFns.formatDistanceToNow(new Date(date), this.dateFnsLocale);
761
- }
762
- return "Invalid Date";
763
- };
764
- LocalizationService.prototype.getLocalizedDistanceInWords = function (endedDate, startedDate) {
765
- if (dateFns.isValid(new Date(endedDate)) && dateFns.isValid(new Date(startedDate))) {
766
- return dateFns.formatDistance(new Date(endedDate), new Date(startedDate), this.dateFnsLocale);
767
- }
768
- return "Invalid Date";
769
- };
770
789
  LocalizationService.prototype.safeUtcToZonedTime = function (date) {
771
790
  var result = date;
772
791
  try {
@@ -846,10 +865,6 @@
846
865
  if (type === 'dt') {
847
866
  return this.localizeService.getLocalizedDateTime(inputData);
848
867
  }
849
- //UTC DateTime
850
- if (type === 'u2dt') {
851
- return this.localizeService.getUTCToLocalizedDateTime(inputData);
852
- }
853
868
  //DistanceInWords
854
869
  if (type === 'dis') {
855
870
  return this.localizeService.getLocalizedDistanceInWords(inputData, param2);
@@ -858,6 +873,16 @@
858
873
  if (type === 'dis2now') {
859
874
  return this.localizeService.getLocalizedDistanceToNowInWords(inputData);
860
875
  }
876
+ //UTC Operations --------------------------------------------------------------
877
+ //UTC Date
878
+ if (type === 'u2d') {
879
+ return this.localizeService.getUTCToLocalizedDate(inputData);
880
+ }
881
+ //UTC DateTime
882
+ if (type === 'u2dt') {
883
+ return this.localizeService.getUTCToLocalizedDateTime(inputData);
884
+ }
885
+ //UTC DistanceToNowInWords
861
886
  if (type === 'u2dis2now') {
862
887
  return this.localizeService.getUTCToLocalizedDistanceToNowInWords(inputData);
863
888
  }
@@ -1491,12 +1516,6 @@
1491
1516
  return this.http.delete(url, { responseType: responseType });
1492
1517
  };
1493
1518
  //gets
1494
- BaseApiService.prototype.getById = function (id) {
1495
- return this.get('getById', { id: id });
1496
- };
1497
- BaseApiService.prototype.getAll = function (data) {
1498
- return this.get('getAll', data).pipe(operators.map(function (res) { return res; }));
1499
- };
1500
1519
  BaseApiService.prototype.getExternalTextFile = function (url) {
1501
1520
  return this.http.get(url);
1502
1521
  };