@learncard/react 3.0.0 → 3.0.2

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 (119) hide show
  1. package/dist/cjs/{BoostGenericCard-8767d920.js → BoostGenericCard-87cd2091.js} +3 -3
  2. package/dist/cjs/{BoostGenericCard-8767d920.js.map → BoostGenericCard-87cd2091.js.map} +1 -1
  3. package/dist/cjs/{CertificateDisplayCard-1d4bca84.js → CertificateDisplayCard-d4300c7d.js} +16 -11
  4. package/dist/cjs/CertificateDisplayCard-d4300c7d.js.map +1 -0
  5. package/dist/cjs/{MeritBadgeDisplayCard-0b5241e4.js → MeritBadgeDisplayCard-30ef639d.js} +16 -10
  6. package/dist/cjs/MeritBadgeDisplayCard-30ef639d.js.map +1 -0
  7. package/dist/cjs/{MeritBadgeSkillsCount-0bd63bcd.js → MeritBadgeSkillsCount-a6127a40.js} +2 -2
  8. package/dist/cjs/{MeritBadgeSkillsCount-0bd63bcd.js.map → MeritBadgeSkillsCount-a6127a40.js.map} +1 -1
  9. package/dist/cjs/{SchoolIDCard-0462e21c.js → SchoolIDCard-20e87b6a.js} +3 -1184
  10. package/dist/cjs/SchoolIDCard-20e87b6a.js.map +1 -0
  11. package/dist/cjs/{VCCard-c4767894.js → VCCard-679fceaa.js} +3 -3
  12. package/dist/cjs/{VCCard-c4767894.js.map → VCCard-679fceaa.js.map} +1 -1
  13. package/dist/cjs/{VCDisplayBackFace-c73ce3f6.js → VCDisplayBackFace-65e36d2b.js} +3 -3
  14. package/dist/cjs/{VCDisplayBackFace-c73ce3f6.js.map → VCDisplayBackFace-65e36d2b.js.map} +1 -1
  15. package/dist/cjs/{VCDisplayCard-7832f605.js → VCDisplayCard-51e917ab.js} +3 -3
  16. package/dist/cjs/{VCDisplayCard-7832f605.js.map → VCDisplayCard-51e917ab.js.map} +1 -1
  17. package/dist/cjs/{VCDisplayCard2-7ae4e64b.js → VCDisplayCard2-9567ffe2.js} +9 -8
  18. package/dist/cjs/{VCDisplayCard2-7ae4e64b.js.map → VCDisplayCard2-9567ffe2.js.map} +1 -1
  19. package/dist/cjs/{VCVerificationPill-0f27e8e0.js → VCVerificationPill-d4ee15ca.js} +2 -2
  20. package/dist/cjs/{VCVerificationPill-0f27e8e0.js.map → VCVerificationPill-d4ee15ca.js.map} +1 -1
  21. package/dist/cjs/{VerifierStateBadgeAndText-6bc07df3.js → VerifierStateBadgeAndText-04c90074.js} +2 -2
  22. package/dist/cjs/{VerifierStateBadgeAndText-6bc07df3.js.map → VerifierStateBadgeAndText-04c90074.js.map} +1 -1
  23. package/dist/cjs/{credential.helpers-da94e829.js → credential.helpers-14544e48.js} +240 -6
  24. package/dist/cjs/credential.helpers-14544e48.js.map +1 -0
  25. package/dist/cjs/{i18n-ddbb18e7.js → i18n-0648eec1.js} +3 -1
  26. package/dist/cjs/i18n-0648eec1.js.map +1 -0
  27. package/dist/cjs/index-47efbf5b.js +1186 -0
  28. package/dist/cjs/index-47efbf5b.js.map +1 -0
  29. package/dist/cjs/{index-da255c9a.js → index-a03dec43.js} +3 -1
  30. package/dist/{esm/index-cb3a593b.js.map → cjs/index-a03dec43.js.map} +1 -1
  31. package/dist/cjs/index.js +16 -15
  32. package/dist/cjs/index.js.map +1 -1
  33. package/dist/cjs/index14.js +16 -15
  34. package/dist/cjs/index14.js.map +1 -1
  35. package/dist/cjs/index22.js +7 -7
  36. package/dist/cjs/index31.js +2 -1
  37. package/dist/cjs/index31.js.map +1 -1
  38. package/dist/cjs/index39.js +13 -12
  39. package/dist/cjs/index39.js.map +1 -1
  40. package/dist/cjs/index4.js +5 -5
  41. package/dist/cjs/index40.js +5 -5
  42. package/dist/cjs/index41.js +6 -6
  43. package/dist/cjs/index42.js +9 -8
  44. package/dist/cjs/index42.js.map +1 -1
  45. package/dist/cjs/index43.js +2 -2
  46. package/dist/cjs/index46.js +2 -2
  47. package/dist/cjs/index7.js +6 -6
  48. package/dist/cjs/{types.esm-ad9cf6de.js → types.esm-55f8d7fb.js} +3633 -1573
  49. package/dist/cjs/types.esm-55f8d7fb.js.map +1 -0
  50. package/dist/esm/{BoostGenericCard-fec5d413.js → BoostGenericCard-dd2b515a.js} +3 -3
  51. package/dist/esm/{BoostGenericCard-fec5d413.js.map → BoostGenericCard-dd2b515a.js.map} +1 -1
  52. package/dist/esm/{CertificateDisplayCard-c0748577.js → CertificateDisplayCard-46c13c49.js} +16 -11
  53. package/dist/esm/CertificateDisplayCard-46c13c49.js.map +1 -0
  54. package/dist/esm/{MeritBadgeDisplayCard-0433ad9d.js → MeritBadgeDisplayCard-9f95dd08.js} +16 -10
  55. package/dist/esm/MeritBadgeDisplayCard-9f95dd08.js.map +1 -0
  56. package/dist/esm/{MeritBadgeSkillsCount-434bc6ed.js → MeritBadgeSkillsCount-c20f9f60.js} +2 -2
  57. package/dist/esm/{MeritBadgeSkillsCount-434bc6ed.js.map → MeritBadgeSkillsCount-c20f9f60.js.map} +1 -1
  58. package/dist/esm/{SchoolIDCard-de65b2bd.js → SchoolIDCard-d7b84a54.js} +2 -1183
  59. package/dist/esm/SchoolIDCard-d7b84a54.js.map +1 -0
  60. package/dist/esm/{VCCard-c8816edc.js → VCCard-b49261ab.js} +3 -3
  61. package/dist/esm/{VCCard-c8816edc.js.map → VCCard-b49261ab.js.map} +1 -1
  62. package/dist/esm/{VCDisplayBackFace-b6451634.js → VCDisplayBackFace-eb2cad59.js} +3 -3
  63. package/dist/esm/{VCDisplayBackFace-b6451634.js.map → VCDisplayBackFace-eb2cad59.js.map} +1 -1
  64. package/dist/esm/{VCDisplayCard-31a8f581.js → VCDisplayCard-1400714d.js} +3 -3
  65. package/dist/esm/{VCDisplayCard-31a8f581.js.map → VCDisplayCard-1400714d.js.map} +1 -1
  66. package/dist/esm/{VCDisplayCard2-8ef4a6b6.js → VCDisplayCard2-b6ff7873.js} +9 -8
  67. package/dist/esm/{VCDisplayCard2-8ef4a6b6.js.map → VCDisplayCard2-b6ff7873.js.map} +1 -1
  68. package/dist/esm/{VCVerificationPill-bd76c5bc.js → VCVerificationPill-65f7901a.js} +2 -2
  69. package/dist/esm/{VCVerificationPill-bd76c5bc.js.map → VCVerificationPill-65f7901a.js.map} +1 -1
  70. package/dist/esm/{VerifierStateBadgeAndText-12066b2a.js → VerifierStateBadgeAndText-1588afeb.js} +2 -2
  71. package/dist/esm/{VerifierStateBadgeAndText-12066b2a.js.map → VerifierStateBadgeAndText-1588afeb.js.map} +1 -1
  72. package/dist/esm/{credential.helpers-f55a4962.js → credential.helpers-4c72d304.js} +240 -6
  73. package/dist/esm/credential.helpers-4c72d304.js.map +1 -0
  74. package/dist/esm/{i18n-35209bfa.js → i18n-b142d48e.js} +3 -1
  75. package/dist/esm/i18n-b142d48e.js.map +1 -0
  76. package/dist/esm/{index-cb3a593b.js → index-75c5b01c.js} +2 -2
  77. package/dist/{cjs/index-da255c9a.js.map → esm/index-75c5b01c.js.map} +1 -1
  78. package/dist/esm/index-cbd2e9db.js +1184 -0
  79. package/dist/esm/index-cbd2e9db.js.map +1 -0
  80. package/dist/esm/index.js +16 -15
  81. package/dist/esm/index.js.map +1 -1
  82. package/dist/esm/index14.js +16 -15
  83. package/dist/esm/index14.js.map +1 -1
  84. package/dist/esm/index22.js +7 -7
  85. package/dist/esm/index31.js +2 -1
  86. package/dist/esm/index31.js.map +1 -1
  87. package/dist/esm/index39.js +13 -12
  88. package/dist/esm/index39.js.map +1 -1
  89. package/dist/esm/index4.js +5 -5
  90. package/dist/esm/index40.js +5 -5
  91. package/dist/esm/index41.js +6 -6
  92. package/dist/esm/index42.js +9 -8
  93. package/dist/esm/index42.js.map +1 -1
  94. package/dist/esm/index43.js +2 -2
  95. package/dist/esm/index46.js +2 -2
  96. package/dist/esm/index7.js +6 -6
  97. package/dist/esm/{types.esm-383b69a5.js → types.esm-a70402df.js} +3633 -1573
  98. package/dist/esm/types.esm-a70402df.js.map +1 -0
  99. package/package.json +9 -9
  100. package/src/components/CertificateDisplayCard/CertificateAwardDate.test.tsx +67 -0
  101. package/src/components/CertificateDisplayCard/CertificateBackFace.tsx +14 -7
  102. package/src/components/CertificateDisplayCard/CertificateFrontFace.tsx +11 -2
  103. package/src/components/MeritBadgeDisplayCard/MeritBadgeBackFace.tsx +14 -7
  104. package/src/components/MeritBadgeDisplayCard/MeritBadgeFrontFace.tsx +11 -6
  105. package/src/helpers/credential.helpers.test.ts +96 -0
  106. package/src/helpers/credential.helpers.tsx +23 -4
  107. package/src/i18n/index.tsx +2 -0
  108. package/dist/cjs/CertificateDisplayCard-1d4bca84.js.map +0 -1
  109. package/dist/cjs/MeritBadgeDisplayCard-0b5241e4.js.map +0 -1
  110. package/dist/cjs/SchoolIDCard-0462e21c.js.map +0 -1
  111. package/dist/cjs/credential.helpers-da94e829.js.map +0 -1
  112. package/dist/cjs/i18n-ddbb18e7.js.map +0 -1
  113. package/dist/cjs/types.esm-ad9cf6de.js.map +0 -1
  114. package/dist/esm/CertificateDisplayCard-c0748577.js.map +0 -1
  115. package/dist/esm/MeritBadgeDisplayCard-0433ad9d.js.map +0 -1
  116. package/dist/esm/SchoolIDCard-de65b2bd.js.map +0 -1
  117. package/dist/esm/credential.helpers-f55a4962.js.map +0 -1
  118. package/dist/esm/i18n-35209bfa.js.map +0 -1
  119. package/dist/esm/types.esm-383b69a5.js.map +0 -1
@@ -1,8 +1,8 @@
1
1
  'use strict';
2
2
 
3
3
  var React = require('react');
4
- var index = require('./index-da255c9a.js');
5
- var types_esm = require('./types.esm-ad9cf6de.js');
4
+ var index = require('./index-a03dec43.js');
5
+ var types_esm = require('./types.esm-55f8d7fb.js');
6
6
  var index$1 = require('./index-3daa4cfe.js');
7
7
  var PuzzlePiece = require('./PuzzlePiece-48ee8924.js');
8
8
  var User = require('./User-54049eba.js');
@@ -2252,6 +2252,232 @@ function cleanEscapedString(input) {
2252
2252
  return matched[1].replace(doubleQuoteRegExp, "'");
2253
2253
  }
2254
2254
 
2255
+ /**
2256
+ * @name parseISO
2257
+ * @category Common Helpers
2258
+ * @summary Parse ISO string
2259
+ *
2260
+ * @description
2261
+ * Parse the given string in ISO 8601 format and return an instance of Date.
2262
+ *
2263
+ * Function accepts complete ISO 8601 formats as well as partial implementations.
2264
+ * ISO 8601: http://en.wikipedia.org/wiki/ISO_8601
2265
+ *
2266
+ * If the argument isn't a string, the function cannot parse the string or
2267
+ * the values are invalid, it returns Invalid Date.
2268
+ *
2269
+ * @param {String} argument - the value to convert
2270
+ * @param {Object} [options] - an object with options.
2271
+ * @param {0|1|2} [options.additionalDigits=2] - the additional number of digits in the extended year format
2272
+ * @returns {Date} the parsed date in the local time zone
2273
+ * @throws {TypeError} 1 argument required
2274
+ * @throws {RangeError} `options.additionalDigits` must be 0, 1 or 2
2275
+ *
2276
+ * @example
2277
+ * // Convert string '2014-02-11T11:30:30' to date:
2278
+ * const result = parseISO('2014-02-11T11:30:30')
2279
+ * //=> Tue Feb 11 2014 11:30:30
2280
+ *
2281
+ * @example
2282
+ * // Convert string '+02014101' to date,
2283
+ * // if the additional number of digits in the extended year format is 1:
2284
+ * const result = parseISO('+02014101', { additionalDigits: 1 })
2285
+ * //=> Fri Apr 11 2014 00:00:00
2286
+ */
2287
+ function parseISO(argument, options) {
2288
+ var _options$additionalDi;
2289
+ index.requiredArgs(1, arguments);
2290
+ var additionalDigits = index.toInteger((_options$additionalDi = options === null || options === void 0 ? void 0 : options.additionalDigits) !== null && _options$additionalDi !== void 0 ? _options$additionalDi : 2);
2291
+ if (additionalDigits !== 2 && additionalDigits !== 1 && additionalDigits !== 0) {
2292
+ throw new RangeError('additionalDigits must be 0, 1 or 2');
2293
+ }
2294
+ if (!(typeof argument === 'string' || Object.prototype.toString.call(argument) === '[object String]')) {
2295
+ return new Date(NaN);
2296
+ }
2297
+ var dateStrings = splitDateString(argument);
2298
+ var date;
2299
+ if (dateStrings.date) {
2300
+ var parseYearResult = parseYear(dateStrings.date, additionalDigits);
2301
+ date = parseDate(parseYearResult.restDateString, parseYearResult.year);
2302
+ }
2303
+ if (!date || isNaN(date.getTime())) {
2304
+ return new Date(NaN);
2305
+ }
2306
+ var timestamp = date.getTime();
2307
+ var time = 0;
2308
+ var offset;
2309
+ if (dateStrings.time) {
2310
+ time = parseTime(dateStrings.time);
2311
+ if (isNaN(time)) {
2312
+ return new Date(NaN);
2313
+ }
2314
+ }
2315
+ if (dateStrings.timezone) {
2316
+ offset = parseTimezone(dateStrings.timezone);
2317
+ if (isNaN(offset)) {
2318
+ return new Date(NaN);
2319
+ }
2320
+ } else {
2321
+ var dirtyDate = new Date(timestamp + time);
2322
+ // js parsed string assuming it's in UTC timezone
2323
+ // but we need it to be parsed in our timezone
2324
+ // so we use utc values to build date in our timezone.
2325
+ // Year values from 0 to 99 map to the years 1900 to 1999
2326
+ // so set year explicitly with setFullYear.
2327
+ var result = new Date(0);
2328
+ result.setFullYear(dirtyDate.getUTCFullYear(), dirtyDate.getUTCMonth(), dirtyDate.getUTCDate());
2329
+ result.setHours(dirtyDate.getUTCHours(), dirtyDate.getUTCMinutes(), dirtyDate.getUTCSeconds(), dirtyDate.getUTCMilliseconds());
2330
+ return result;
2331
+ }
2332
+ return new Date(timestamp + time + offset);
2333
+ }
2334
+ var patterns = {
2335
+ dateTimeDelimiter: /[T ]/,
2336
+ timeZoneDelimiter: /[Z ]/i,
2337
+ timezone: /([Z+-].*)$/
2338
+ };
2339
+ var dateRegex = /^-?(?:(\d{3})|(\d{2})(?:-?(\d{2}))?|W(\d{2})(?:-?(\d{1}))?|)$/;
2340
+ var timeRegex = /^(\d{2}(?:[.,]\d*)?)(?::?(\d{2}(?:[.,]\d*)?))?(?::?(\d{2}(?:[.,]\d*)?))?$/;
2341
+ var timezoneRegex = /^([+-])(\d{2})(?::?(\d{2}))?$/;
2342
+ function splitDateString(dateString) {
2343
+ var dateStrings = {};
2344
+ var array = dateString.split(patterns.dateTimeDelimiter);
2345
+ var timeString;
2346
+
2347
+ // The regex match should only return at maximum two array elements.
2348
+ // [date], [time], or [date, time].
2349
+ if (array.length > 2) {
2350
+ return dateStrings;
2351
+ }
2352
+ if (/:/.test(array[0])) {
2353
+ timeString = array[0];
2354
+ } else {
2355
+ dateStrings.date = array[0];
2356
+ timeString = array[1];
2357
+ if (patterns.timeZoneDelimiter.test(dateStrings.date)) {
2358
+ dateStrings.date = dateString.split(patterns.timeZoneDelimiter)[0];
2359
+ timeString = dateString.substr(dateStrings.date.length, dateString.length);
2360
+ }
2361
+ }
2362
+ if (timeString) {
2363
+ var token = patterns.timezone.exec(timeString);
2364
+ if (token) {
2365
+ dateStrings.time = timeString.replace(token[1], '');
2366
+ dateStrings.timezone = token[1];
2367
+ } else {
2368
+ dateStrings.time = timeString;
2369
+ }
2370
+ }
2371
+ return dateStrings;
2372
+ }
2373
+ function parseYear(dateString, additionalDigits) {
2374
+ var regex = new RegExp('^(?:(\\d{4}|[+-]\\d{' + (4 + additionalDigits) + '})|(\\d{2}|[+-]\\d{' + (2 + additionalDigits) + '})$)');
2375
+ var captures = dateString.match(regex);
2376
+ // Invalid ISO-formatted year
2377
+ if (!captures) return {
2378
+ year: NaN,
2379
+ restDateString: ''
2380
+ };
2381
+ var year = captures[1] ? parseInt(captures[1]) : null;
2382
+ var century = captures[2] ? parseInt(captures[2]) : null;
2383
+
2384
+ // either year or century is null, not both
2385
+ return {
2386
+ year: century === null ? year : century * 100,
2387
+ restDateString: dateString.slice((captures[1] || captures[2]).length)
2388
+ };
2389
+ }
2390
+ function parseDate(dateString, year) {
2391
+ // Invalid ISO-formatted year
2392
+ if (year === null) return new Date(NaN);
2393
+ var captures = dateString.match(dateRegex);
2394
+ // Invalid ISO-formatted string
2395
+ if (!captures) return new Date(NaN);
2396
+ var isWeekDate = !!captures[4];
2397
+ var dayOfYear = parseDateUnit(captures[1]);
2398
+ var month = parseDateUnit(captures[2]) - 1;
2399
+ var day = parseDateUnit(captures[3]);
2400
+ var week = parseDateUnit(captures[4]);
2401
+ var dayOfWeek = parseDateUnit(captures[5]) - 1;
2402
+ if (isWeekDate) {
2403
+ if (!validateWeekDate(year, week, dayOfWeek)) {
2404
+ return new Date(NaN);
2405
+ }
2406
+ return dayOfISOWeekYear(year, week, dayOfWeek);
2407
+ } else {
2408
+ var date = new Date(0);
2409
+ if (!validateDate(year, month, day) || !validateDayOfYearDate(year, dayOfYear)) {
2410
+ return new Date(NaN);
2411
+ }
2412
+ date.setUTCFullYear(year, month, Math.max(dayOfYear, day));
2413
+ return date;
2414
+ }
2415
+ }
2416
+ function parseDateUnit(value) {
2417
+ return value ? parseInt(value) : 1;
2418
+ }
2419
+ function parseTime(timeString) {
2420
+ var captures = timeString.match(timeRegex);
2421
+ if (!captures) return NaN; // Invalid ISO-formatted time
2422
+
2423
+ var hours = parseTimeUnit(captures[1]);
2424
+ var minutes = parseTimeUnit(captures[2]);
2425
+ var seconds = parseTimeUnit(captures[3]);
2426
+ if (!validateTime(hours, minutes, seconds)) {
2427
+ return NaN;
2428
+ }
2429
+ return hours * index.millisecondsInHour + minutes * index.millisecondsInMinute + seconds * 1000;
2430
+ }
2431
+ function parseTimeUnit(value) {
2432
+ return value && parseFloat(value.replace(',', '.')) || 0;
2433
+ }
2434
+ function parseTimezone(timezoneString) {
2435
+ if (timezoneString === 'Z') return 0;
2436
+ var captures = timezoneString.match(timezoneRegex);
2437
+ if (!captures) return 0;
2438
+ var sign = captures[1] === '+' ? -1 : 1;
2439
+ var hours = parseInt(captures[2]);
2440
+ var minutes = captures[3] && parseInt(captures[3]) || 0;
2441
+ if (!validateTimezone(hours, minutes)) {
2442
+ return NaN;
2443
+ }
2444
+ return sign * (hours * index.millisecondsInHour + minutes * index.millisecondsInMinute);
2445
+ }
2446
+ function dayOfISOWeekYear(isoWeekYear, week, day) {
2447
+ var date = new Date(0);
2448
+ date.setUTCFullYear(isoWeekYear, 0, 4);
2449
+ var fourthOfJanuaryDay = date.getUTCDay() || 7;
2450
+ var diff = (week - 1) * 7 + day + 1 - fourthOfJanuaryDay;
2451
+ date.setUTCDate(date.getUTCDate() + diff);
2452
+ return date;
2453
+ }
2454
+
2455
+ // Validation functions
2456
+
2457
+ // February is null to handle the leap year (using ||)
2458
+ var daysInMonths = [31, null, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31];
2459
+ function isLeapYearIndex(year) {
2460
+ return year % 400 === 0 || year % 4 === 0 && year % 100 !== 0;
2461
+ }
2462
+ function validateDate(year, month, date) {
2463
+ return month >= 0 && month <= 11 && date >= 1 && date <= (daysInMonths[month] || (isLeapYearIndex(year) ? 29 : 28));
2464
+ }
2465
+ function validateDayOfYearDate(year, dayOfYear) {
2466
+ return dayOfYear >= 1 && dayOfYear <= (isLeapYearIndex(year) ? 366 : 365);
2467
+ }
2468
+ function validateWeekDate(_year, week, day) {
2469
+ return week >= 1 && week <= 53 && day >= 0 && day <= 6;
2470
+ }
2471
+ function validateTime(hours, minutes, seconds) {
2472
+ if (hours === 24) {
2473
+ return minutes === 0 && seconds === 0;
2474
+ }
2475
+ return seconds >= 0 && seconds < 60 && minutes >= 0 && minutes < 60 && hours >= 0 && hours < 25;
2476
+ }
2477
+ function validateTimezone(_hours, minutes) {
2478
+ return minutes >= 0 && minutes <= 59;
2479
+ }
2480
+
2255
2481
  const getImageFromImage = (image) => {
2256
2482
  var _a;
2257
2483
  if (typeof image === "string") return image;
@@ -2266,18 +2492,26 @@ const getImageFromProfile = (profile) => {
2266
2492
  if (typeof profile === "string") return "";
2267
2493
  return getImageFromImage((_a = profile.image) != null ? _a : "");
2268
2494
  };
2269
- const getInfoFromCredential = (credential, dateFormat = "dd MMM yyyy", options = { uppercaseDate: true }) => {
2495
+ const getInfoFromCredential = (credential, dateFormat = "dd MMM yyyy", options = {
2496
+ uppercaseDate: true
2497
+ }) => {
2270
2498
  var _a, _b;
2271
2499
  const { issuer, issuanceDate, validFrom } = credential;
2272
2500
  const credentialSubject = Array.isArray(credential.credentialSubject) ? credential.credentialSubject[0] : credential.credentialSubject;
2273
2501
  const title = (_a = credentialSubject.achievement) == null ? void 0 : _a.name;
2274
2502
  const issuee = credentialSubject.id;
2275
2503
  const imageUrl = (_b = credentialSubject.achievement) == null ? void 0 : _b.image;
2276
- const dateValue = validFrom || issuanceDate;
2504
+ const awardDateText = typeof credential.awardedDate === "string" ? credential.awardedDate : "";
2505
+ const awardedDate = options.dateType === "awarded" && awardDateText ? parseISO(awardDateText) : void 0;
2506
+ const validAwardedDate = awardedDate && isValid(awardedDate) ? awardedDate : void 0;
2507
+ const dateValue = validAwardedDate != null ? validAwardedDate : validFrom || issuanceDate;
2277
2508
  let createdAt = "";
2278
2509
  if (dateValue) {
2279
2510
  try {
2280
- createdAt = format(new Date(dateValue), dateFormat);
2511
+ const date = dateValue instanceof Date ? dateValue : new Date(dateValue);
2512
+ const hasAwardOffset = validAwardedDate && (awardDateText.includes("T") || awardDateText.includes(" ")) && /(?:Z|[+-]\d{2}(?::?\d{2})?)$/i.test(awardDateText.slice(-6));
2513
+ const displayDate = validAwardedDate && hasAwardOffset ? new Date(date.getUTCFullYear(), date.getUTCMonth(), date.getUTCDate()) : date;
2514
+ createdAt = format(displayDate, dateFormat);
2281
2515
  if (options.uppercaseDate) {
2282
2516
  createdAt = createdAt.toUpperCase();
2283
2517
  }
@@ -2460,4 +2694,4 @@ exports.getImageFromProfile = getImageFromProfile;
2460
2694
  exports.getInfoFromCredential = getInfoFromCredential;
2461
2695
  exports.getNameFromProfile = getNameFromProfile;
2462
2696
  exports.getTotalCountOfSkills = getTotalCountOfSkills;
2463
- //# sourceMappingURL=credential.helpers-da94e829.js.map
2697
+ //# sourceMappingURL=credential.helpers-14544e48.js.map