warframe-worldstate-parser 4.3.0 → 4.4.0

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.
@@ -45,7 +45,11 @@ export default class Calendar {
45
45
  this.expiry = parseDate(calendar.Expiry);
46
46
 
47
47
  this.days = Array.isArray(calendar.Days)
48
- ? calendar.Days.filter(Boolean).map((d) => ({ ...d, events: d.events.map((e) => new DayEvent(e)) }))
48
+ ? calendar.Days.filter(Boolean).map((d) => ({
49
+ ...d,
50
+ date: this.getDate(d.day).toISOString(),
51
+ events: d.events.map((e) => new DayEvent(e)),
52
+ }))
49
53
  : [];
50
54
 
51
55
  this.season = translateSeason(calendar.Season);
@@ -56,4 +60,15 @@ export default class Calendar {
56
60
 
57
61
  this.requirements = calendar.UpgradeAvaliabilityRequirements;
58
62
  }
63
+
64
+ /**
65
+ * Converts number of day to a date in 1999 in UTC
66
+ * @param {number} day number of the day in a year
67
+ * @returns {Date} the date in 1999
68
+ */
69
+ getDate(day) {
70
+ const date = new Date(Date.UTC(1999));
71
+ date.setUTCDate(date.getUTCDate() + day - 1);
72
+ return date;
73
+ }
59
74
  }
@@ -268,6 +268,12 @@ export default class WorldEvent extends WorldstateObject {
268
268
  if (data.JobAffiliationTag) {
269
269
  this.affiliatedWith = syndicate(data.JobAffiliationTag, locale);
270
270
  }
271
+
272
+ /**
273
+ * The event's tag
274
+ * @type {string}
275
+ */
276
+ this.tag = data.Tag;
271
277
  }
272
278
 
273
279
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "warframe-worldstate-parser",
3
- "version": "4.3.0",
3
+ "version": "4.4.0",
4
4
  "description": "An Open parser for Warframe's Worldstate in Javascript",
5
5
  "keywords": [
6
6
  "warframe-worldstate",
@@ -7,4 +7,10 @@ export default class Calendar {
7
7
  yearIteration: any;
8
8
  version: any;
9
9
  requirements: any;
10
+ /**
11
+ * Converts number of day to a date in 1999 in UTC
12
+ * @param {number} day number of the day in a year
13
+ * @returns {Date} the date in 1999
14
+ */
15
+ getDate(day: number): Date;
10
16
  }
@@ -167,6 +167,11 @@ export default class WorldEvent extends WorldstateObject {
167
167
  activation: any;
168
168
  };
169
169
  affiliatedWith: any;
170
+ /**
171
+ * The event's tag
172
+ * @type {string}
173
+ */
174
+ tag: string;
170
175
  /**
171
176
  * Get whether the event has expired
172
177
  * @returns {boolean} whether the event has expired