@eso-status/forum-message 2.0.0-dev.8 → 2.0.0-dev.9

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.
@@ -53,21 +53,6 @@ export default class DateFormatter {
53
53
  * @private
54
54
  */
55
55
  private getRawHour;
56
- /**
57
- * Method to check if the time in parentheses is in UTC or not
58
- * @private
59
- */
60
- private isUTCHour;
61
- /**
62
- * Method to retrieve the time when it is in UTC
63
- * @private
64
- */
65
- private getRawUTCHour;
66
- /**
67
- * Method for retrieving the time when it is not in UTC
68
- * @private
69
- */
70
- private getRawNoUTCHour;
71
56
  /**
72
57
  * Method for retrieving the minute number of the start time for case #1
73
58
  * @private
@@ -78,21 +63,6 @@ export default class DateFormatter {
78
63
  * @private
79
64
  */
80
65
  private getRawClassicHour2;
81
- /**
82
- * Method to check if the second time in parentheses is in UTC or not
83
- * @private
84
- */
85
- private isUTCClassicHour2;
86
- /**
87
- * Method to retrieve the second time when it is in UTC
88
- * @private
89
- */
90
- private getRawUTCClassicHour2;
91
- /**
92
- * Method to retrieve the second time when it is not in UTC
93
- * @private
94
- */
95
- private getRawNoUTCClassicHour2;
96
66
  /**
97
67
  * Method for retrieving the minute number of the end time in case #1
98
68
  * @private
@@ -79,77 +79,38 @@ class DateFormatter {
79
79
  * @private
80
80
  */
81
81
  getRawHour() {
82
- if (this.isUTCHour()) {
83
- return this.getRawUTCHour();
84
- }
85
- return this.getRawNoUTCHour();
86
- }
87
- /**
88
- * Method to check if the time in parentheses is in UTC or not
89
- * @private
90
- */
91
- isUTCHour() {
92
- return (this.rawDate.split(' UTC)').length === 3 ||
93
- this.rawDate.split(' UTC)').length === 2);
94
- }
95
- /**
96
- * Method to retrieve the time when it is in UTC
97
- * @private
98
- */
99
- getRawUTCHour() {
100
- return Number(this.rawDate.split('(')[1].split(':')[0]);
101
- }
102
- /**
103
- * Method for retrieving the time when it is not in UTC
104
- * @private
105
- */
106
- getRawNoUTCHour() {
107
- return Number(this.rawDate.split(':')[0].split(', ')[1]);
82
+ return Number(this.rawDate
83
+ .split(' UTC')[0]
84
+ .split(' ')
85
+ .pop()
86
+ .split(':')[0]
87
+ .replace('(', ''));
108
88
  }
109
89
  /**
110
90
  * Method for retrieving the minute number of the start time for case #1
111
91
  * @private
112
92
  */
113
93
  getRawClassicMinute1() {
114
- return Number(this.rawDate.split('(')[1].split(':')[1].split(' ')[0]);
94
+ return Number(this.rawDate.split(' UTC')[0].split(':').pop());
115
95
  }
116
96
  /**
117
97
  * Method for retrieving the end hour number in case #1
118
98
  * @private
119
99
  */
120
100
  getRawClassicHour2() {
121
- if (this.isUTCClassicHour2()) {
122
- return this.getRawUTCClassicHour2();
123
- }
124
- return this.getRawNoUTCClassicHour2();
125
- }
126
- /**
127
- * Method to check if the second time in parentheses is in UTC or not
128
- * @private
129
- */
130
- isUTCClassicHour2() {
131
- return this.rawDate.split(' UTC)').length === 3;
132
- }
133
- /**
134
- * Method to retrieve the second time when it is in UTC
135
- * @private
136
- */
137
- getRawUTCClassicHour2() {
138
- return Number(this.rawDate.split('(')[2].split(':')[0]);
139
- }
140
- /**
141
- * Method to retrieve the second time when it is not in UTC
142
- * @private
143
- */
144
- getRawNoUTCClassicHour2() {
145
- return Number(this.rawDate.split(' - ')[1].split(':')[0]);
101
+ return Number(this.rawDate
102
+ .split(' UTC')[1]
103
+ .split(' ')
104
+ .pop()
105
+ .split(':')[0]
106
+ .replace('(', ''));
146
107
  }
147
108
  /**
148
109
  * Method for retrieving the minute number of the end time in case #1
149
110
  * @private
150
111
  */
151
112
  getRawClassicMinute2() {
152
- return Number(this.rawDate.split('(')[2].split(':')[1].split(' ')[0]);
113
+ return Number(this.rawDate.split(' UTC')[1].split(':').pop());
153
114
  }
154
115
  /**
155
116
  * Method for generating the correctly formatted date in case #2
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@eso-status/forum-message",
3
- "version": "2.0.0-dev.8",
3
+ "version": "2.0.0-dev.9",
4
4
  "description": "Library for retrieving and formatting data, available at https://forums.elderscrollsonline.com or https://forums.elderscrollsonline.com/en/categories/pts",
5
5
  "author": "@dov118 <contact@dov118.dev> (https://dov118.dev)",
6
6
  "main": "lib/index.js",