steamutils 1.5.53 → 1.5.55

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.
package/index.js CHANGED
@@ -21,7 +21,7 @@ import { AppID_CSGO, E1GameBanOnRecord, E1VACBanOnRecord, EActivityType, ECommen
21
21
  import SteamTotp from "steam-totp";
22
22
  import { SteamProto, SteamProtoType } from "./steamproto.js";
23
23
  import EventEmitter from "node:events";
24
- import { extractAssetItemsFromHovers, parseMarketHistoryListings, parseMarketListings, parseSteamProfileXmlToJson, parseUserProfile } from "./parse_html.js";
24
+ import { extractAssetItemsFromHovers, parseMarketHistoryListings, parseMarketListings, parseSteamProfileXmlToJson } from "./parse_html.js";
25
25
 
26
26
  const eventEmitter = (globalThis.steamUserEventEmitter = new EventEmitter());
27
27
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "steamutils",
3
- "version": "1.5.53",
3
+ "version": "1.5.55",
4
4
  "main": "index.js",
5
5
  "dependencies": {
6
6
  "alpha-common-utils": "^1.0.6",
package/parse_html.js CHANGED
@@ -2,6 +2,7 @@ import { StringUtils } from "alpha-common-utils/index.js";
2
2
  import { formatMarketHistoryDate, getAvatarHashFromUrl } from "./utils.js";
3
3
  import * as cheerio from "cheerio";
4
4
  import { getJSObjectFronXML } from "./xml2json.js";
5
+ import moment from "moment";
5
6
 
6
7
  /**
7
8
  * @typedef {Object} HoverItem
@@ -246,7 +247,7 @@ export function parseMarketListings(html) {
246
247
  * @property {string} tradeBanState
247
248
  * @property {number} isLimitedAccount
248
249
  * @property {string} customURL
249
- * @property {string} memberSince
250
+ * @property {number | null} memberSince
250
251
  * @property {string} steamRating
251
252
  * @property {number} hoursPlayed2Wk
252
253
  * @property {string} headline
@@ -308,6 +309,17 @@ export function parseSteamProfileXmlToJson(xml) {
308
309
  const avatarUrl = profile.avatarFull || profile.avatarMedium || profile.avatarIcon;
309
310
  profile.avatarHash = getAvatarHashFromUrl(avatarUrl);
310
311
 
312
+ const memberSince = profile.memberSince;
313
+ profile.memberSince = null;
314
+ const formats = ["MMMM DD, YYYY", "MMMM D, YYYY", "MMMM DD", "MMMM D"];
315
+ for (const format of formats) {
316
+ const memberSinceMoment = moment(memberSince, format, true);
317
+ if (memberSinceMoment.isValid()) {
318
+ profile.memberSince = memberSinceMoment.valueOf();
319
+ break;
320
+ }
321
+ }
322
+
311
323
  // Ensure all simple fields are strings if empty object
312
324
  for (const key in profile) {
313
325
  if (typeof profile[key] === "object" && profile[key] !== null && Object.keys(profile[key]).length === 0) {