steamutils 1.5.53 → 1.5.54

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.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/parse_html.js +10 -0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "steamutils",
3
- "version": "1.5.53",
3
+ "version": "1.5.54",
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
@@ -308,6 +309,15 @@ export function parseSteamProfileXmlToJson(xml) {
308
309
  const avatarUrl = profile.avatarFull || profile.avatarMedium || profile.avatarIcon;
309
310
  profile.avatarHash = getAvatarHashFromUrl(avatarUrl);
310
311
 
312
+ const formats = ["MMMM DD, YYYY", "MMMM D, YYYY", "MMMM DD", "MMMM D"];
313
+ for (const format of formats) {
314
+ const memberSinceMoment = moment(profile.memberSince, format, true);
315
+ if (memberSinceMoment.isValid()) {
316
+ profile.memberSince = moment(profile.memberSince, format, true).valueOf();
317
+ break;
318
+ }
319
+ }
320
+
311
321
  // Ensure all simple fields are strings if empty object
312
322
  for (const key in profile) {
313
323
  if (typeof profile[key] === "object" && profile[key] !== null && Object.keys(profile[key]).length === 0) {