@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,6 +1,6 @@
1
1
  import React from 'react';
2
- import { r as requiredArgs, t as toDate, a as toInteger, _ as _typeof, g as getUTCWeekYear, b as getUTCISOWeekYear, c as getUTCWeek, d as getUTCISOWeek, e as getDefaultOptions } from './index-cb3a593b.js';
3
- import { V as VerificationStatusEnum } from './types.esm-383b69a5.js';
2
+ import { r as requiredArgs, t as toDate, a as toInteger, _ as _typeof, g as getUTCWeekYear, b as getUTCISOWeekYear, c as getUTCWeek, d as getUTCISOWeek, e as getDefaultOptions, m as millisecondsInHour, f as millisecondsInMinute } from './index-75c5b01c.js';
3
+ import { V as VerificationStatusEnum } from './types.esm-a70402df.js';
4
4
  import { a as LCCategoryEnum } from './index-8be2f857.js';
5
5
  import { P as PuzzlePiece } from './PuzzlePiece-9c313d93.js';
6
6
  import { U as User, B as Briefcase, G as Graduation } from './User-f5ea0f01.js';
@@ -2246,6 +2246,232 @@ function cleanEscapedString(input) {
2246
2246
  return matched[1].replace(doubleQuoteRegExp, "'");
2247
2247
  }
2248
2248
 
2249
+ /**
2250
+ * @name parseISO
2251
+ * @category Common Helpers
2252
+ * @summary Parse ISO string
2253
+ *
2254
+ * @description
2255
+ * Parse the given string in ISO 8601 format and return an instance of Date.
2256
+ *
2257
+ * Function accepts complete ISO 8601 formats as well as partial implementations.
2258
+ * ISO 8601: http://en.wikipedia.org/wiki/ISO_8601
2259
+ *
2260
+ * If the argument isn't a string, the function cannot parse the string or
2261
+ * the values are invalid, it returns Invalid Date.
2262
+ *
2263
+ * @param {String} argument - the value to convert
2264
+ * @param {Object} [options] - an object with options.
2265
+ * @param {0|1|2} [options.additionalDigits=2] - the additional number of digits in the extended year format
2266
+ * @returns {Date} the parsed date in the local time zone
2267
+ * @throws {TypeError} 1 argument required
2268
+ * @throws {RangeError} `options.additionalDigits` must be 0, 1 or 2
2269
+ *
2270
+ * @example
2271
+ * // Convert string '2014-02-11T11:30:30' to date:
2272
+ * const result = parseISO('2014-02-11T11:30:30')
2273
+ * //=> Tue Feb 11 2014 11:30:30
2274
+ *
2275
+ * @example
2276
+ * // Convert string '+02014101' to date,
2277
+ * // if the additional number of digits in the extended year format is 1:
2278
+ * const result = parseISO('+02014101', { additionalDigits: 1 })
2279
+ * //=> Fri Apr 11 2014 00:00:00
2280
+ */
2281
+ function parseISO(argument, options) {
2282
+ var _options$additionalDi;
2283
+ requiredArgs(1, arguments);
2284
+ var additionalDigits = toInteger((_options$additionalDi = options === null || options === void 0 ? void 0 : options.additionalDigits) !== null && _options$additionalDi !== void 0 ? _options$additionalDi : 2);
2285
+ if (additionalDigits !== 2 && additionalDigits !== 1 && additionalDigits !== 0) {
2286
+ throw new RangeError('additionalDigits must be 0, 1 or 2');
2287
+ }
2288
+ if (!(typeof argument === 'string' || Object.prototype.toString.call(argument) === '[object String]')) {
2289
+ return new Date(NaN);
2290
+ }
2291
+ var dateStrings = splitDateString(argument);
2292
+ var date;
2293
+ if (dateStrings.date) {
2294
+ var parseYearResult = parseYear(dateStrings.date, additionalDigits);
2295
+ date = parseDate(parseYearResult.restDateString, parseYearResult.year);
2296
+ }
2297
+ if (!date || isNaN(date.getTime())) {
2298
+ return new Date(NaN);
2299
+ }
2300
+ var timestamp = date.getTime();
2301
+ var time = 0;
2302
+ var offset;
2303
+ if (dateStrings.time) {
2304
+ time = parseTime(dateStrings.time);
2305
+ if (isNaN(time)) {
2306
+ return new Date(NaN);
2307
+ }
2308
+ }
2309
+ if (dateStrings.timezone) {
2310
+ offset = parseTimezone(dateStrings.timezone);
2311
+ if (isNaN(offset)) {
2312
+ return new Date(NaN);
2313
+ }
2314
+ } else {
2315
+ var dirtyDate = new Date(timestamp + time);
2316
+ // js parsed string assuming it's in UTC timezone
2317
+ // but we need it to be parsed in our timezone
2318
+ // so we use utc values to build date in our timezone.
2319
+ // Year values from 0 to 99 map to the years 1900 to 1999
2320
+ // so set year explicitly with setFullYear.
2321
+ var result = new Date(0);
2322
+ result.setFullYear(dirtyDate.getUTCFullYear(), dirtyDate.getUTCMonth(), dirtyDate.getUTCDate());
2323
+ result.setHours(dirtyDate.getUTCHours(), dirtyDate.getUTCMinutes(), dirtyDate.getUTCSeconds(), dirtyDate.getUTCMilliseconds());
2324
+ return result;
2325
+ }
2326
+ return new Date(timestamp + time + offset);
2327
+ }
2328
+ var patterns = {
2329
+ dateTimeDelimiter: /[T ]/,
2330
+ timeZoneDelimiter: /[Z ]/i,
2331
+ timezone: /([Z+-].*)$/
2332
+ };
2333
+ var dateRegex = /^-?(?:(\d{3})|(\d{2})(?:-?(\d{2}))?|W(\d{2})(?:-?(\d{1}))?|)$/;
2334
+ var timeRegex = /^(\d{2}(?:[.,]\d*)?)(?::?(\d{2}(?:[.,]\d*)?))?(?::?(\d{2}(?:[.,]\d*)?))?$/;
2335
+ var timezoneRegex = /^([+-])(\d{2})(?::?(\d{2}))?$/;
2336
+ function splitDateString(dateString) {
2337
+ var dateStrings = {};
2338
+ var array = dateString.split(patterns.dateTimeDelimiter);
2339
+ var timeString;
2340
+
2341
+ // The regex match should only return at maximum two array elements.
2342
+ // [date], [time], or [date, time].
2343
+ if (array.length > 2) {
2344
+ return dateStrings;
2345
+ }
2346
+ if (/:/.test(array[0])) {
2347
+ timeString = array[0];
2348
+ } else {
2349
+ dateStrings.date = array[0];
2350
+ timeString = array[1];
2351
+ if (patterns.timeZoneDelimiter.test(dateStrings.date)) {
2352
+ dateStrings.date = dateString.split(patterns.timeZoneDelimiter)[0];
2353
+ timeString = dateString.substr(dateStrings.date.length, dateString.length);
2354
+ }
2355
+ }
2356
+ if (timeString) {
2357
+ var token = patterns.timezone.exec(timeString);
2358
+ if (token) {
2359
+ dateStrings.time = timeString.replace(token[1], '');
2360
+ dateStrings.timezone = token[1];
2361
+ } else {
2362
+ dateStrings.time = timeString;
2363
+ }
2364
+ }
2365
+ return dateStrings;
2366
+ }
2367
+ function parseYear(dateString, additionalDigits) {
2368
+ var regex = new RegExp('^(?:(\\d{4}|[+-]\\d{' + (4 + additionalDigits) + '})|(\\d{2}|[+-]\\d{' + (2 + additionalDigits) + '})$)');
2369
+ var captures = dateString.match(regex);
2370
+ // Invalid ISO-formatted year
2371
+ if (!captures) return {
2372
+ year: NaN,
2373
+ restDateString: ''
2374
+ };
2375
+ var year = captures[1] ? parseInt(captures[1]) : null;
2376
+ var century = captures[2] ? parseInt(captures[2]) : null;
2377
+
2378
+ // either year or century is null, not both
2379
+ return {
2380
+ year: century === null ? year : century * 100,
2381
+ restDateString: dateString.slice((captures[1] || captures[2]).length)
2382
+ };
2383
+ }
2384
+ function parseDate(dateString, year) {
2385
+ // Invalid ISO-formatted year
2386
+ if (year === null) return new Date(NaN);
2387
+ var captures = dateString.match(dateRegex);
2388
+ // Invalid ISO-formatted string
2389
+ if (!captures) return new Date(NaN);
2390
+ var isWeekDate = !!captures[4];
2391
+ var dayOfYear = parseDateUnit(captures[1]);
2392
+ var month = parseDateUnit(captures[2]) - 1;
2393
+ var day = parseDateUnit(captures[3]);
2394
+ var week = parseDateUnit(captures[4]);
2395
+ var dayOfWeek = parseDateUnit(captures[5]) - 1;
2396
+ if (isWeekDate) {
2397
+ if (!validateWeekDate(year, week, dayOfWeek)) {
2398
+ return new Date(NaN);
2399
+ }
2400
+ return dayOfISOWeekYear(year, week, dayOfWeek);
2401
+ } else {
2402
+ var date = new Date(0);
2403
+ if (!validateDate(year, month, day) || !validateDayOfYearDate(year, dayOfYear)) {
2404
+ return new Date(NaN);
2405
+ }
2406
+ date.setUTCFullYear(year, month, Math.max(dayOfYear, day));
2407
+ return date;
2408
+ }
2409
+ }
2410
+ function parseDateUnit(value) {
2411
+ return value ? parseInt(value) : 1;
2412
+ }
2413
+ function parseTime(timeString) {
2414
+ var captures = timeString.match(timeRegex);
2415
+ if (!captures) return NaN; // Invalid ISO-formatted time
2416
+
2417
+ var hours = parseTimeUnit(captures[1]);
2418
+ var minutes = parseTimeUnit(captures[2]);
2419
+ var seconds = parseTimeUnit(captures[3]);
2420
+ if (!validateTime(hours, minutes, seconds)) {
2421
+ return NaN;
2422
+ }
2423
+ return hours * millisecondsInHour + minutes * millisecondsInMinute + seconds * 1000;
2424
+ }
2425
+ function parseTimeUnit(value) {
2426
+ return value && parseFloat(value.replace(',', '.')) || 0;
2427
+ }
2428
+ function parseTimezone(timezoneString) {
2429
+ if (timezoneString === 'Z') return 0;
2430
+ var captures = timezoneString.match(timezoneRegex);
2431
+ if (!captures) return 0;
2432
+ var sign = captures[1] === '+' ? -1 : 1;
2433
+ var hours = parseInt(captures[2]);
2434
+ var minutes = captures[3] && parseInt(captures[3]) || 0;
2435
+ if (!validateTimezone(hours, minutes)) {
2436
+ return NaN;
2437
+ }
2438
+ return sign * (hours * millisecondsInHour + minutes * millisecondsInMinute);
2439
+ }
2440
+ function dayOfISOWeekYear(isoWeekYear, week, day) {
2441
+ var date = new Date(0);
2442
+ date.setUTCFullYear(isoWeekYear, 0, 4);
2443
+ var fourthOfJanuaryDay = date.getUTCDay() || 7;
2444
+ var diff = (week - 1) * 7 + day + 1 - fourthOfJanuaryDay;
2445
+ date.setUTCDate(date.getUTCDate() + diff);
2446
+ return date;
2447
+ }
2448
+
2449
+ // Validation functions
2450
+
2451
+ // February is null to handle the leap year (using ||)
2452
+ var daysInMonths = [31, null, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31];
2453
+ function isLeapYearIndex(year) {
2454
+ return year % 400 === 0 || year % 4 === 0 && year % 100 !== 0;
2455
+ }
2456
+ function validateDate(year, month, date) {
2457
+ return month >= 0 && month <= 11 && date >= 1 && date <= (daysInMonths[month] || (isLeapYearIndex(year) ? 29 : 28));
2458
+ }
2459
+ function validateDayOfYearDate(year, dayOfYear) {
2460
+ return dayOfYear >= 1 && dayOfYear <= (isLeapYearIndex(year) ? 366 : 365);
2461
+ }
2462
+ function validateWeekDate(_year, week, day) {
2463
+ return week >= 1 && week <= 53 && day >= 0 && day <= 6;
2464
+ }
2465
+ function validateTime(hours, minutes, seconds) {
2466
+ if (hours === 24) {
2467
+ return minutes === 0 && seconds === 0;
2468
+ }
2469
+ return seconds >= 0 && seconds < 60 && minutes >= 0 && minutes < 60 && hours >= 0 && hours < 25;
2470
+ }
2471
+ function validateTimezone(_hours, minutes) {
2472
+ return minutes >= 0 && minutes <= 59;
2473
+ }
2474
+
2249
2475
  const getImageFromImage = (image) => {
2250
2476
  var _a;
2251
2477
  if (typeof image === "string") return image;
@@ -2260,18 +2486,26 @@ const getImageFromProfile = (profile) => {
2260
2486
  if (typeof profile === "string") return "";
2261
2487
  return getImageFromImage((_a = profile.image) != null ? _a : "");
2262
2488
  };
2263
- const getInfoFromCredential = (credential, dateFormat = "dd MMM yyyy", options = { uppercaseDate: true }) => {
2489
+ const getInfoFromCredential = (credential, dateFormat = "dd MMM yyyy", options = {
2490
+ uppercaseDate: true
2491
+ }) => {
2264
2492
  var _a, _b;
2265
2493
  const { issuer, issuanceDate, validFrom } = credential;
2266
2494
  const credentialSubject = Array.isArray(credential.credentialSubject) ? credential.credentialSubject[0] : credential.credentialSubject;
2267
2495
  const title = (_a = credentialSubject.achievement) == null ? void 0 : _a.name;
2268
2496
  const issuee = credentialSubject.id;
2269
2497
  const imageUrl = (_b = credentialSubject.achievement) == null ? void 0 : _b.image;
2270
- const dateValue = validFrom || issuanceDate;
2498
+ const awardDateText = typeof credential.awardedDate === "string" ? credential.awardedDate : "";
2499
+ const awardedDate = options.dateType === "awarded" && awardDateText ? parseISO(awardDateText) : void 0;
2500
+ const validAwardedDate = awardedDate && isValid(awardedDate) ? awardedDate : void 0;
2501
+ const dateValue = validAwardedDate != null ? validAwardedDate : validFrom || issuanceDate;
2271
2502
  let createdAt = "";
2272
2503
  if (dateValue) {
2273
2504
  try {
2274
- createdAt = format(new Date(dateValue), dateFormat);
2505
+ const date = dateValue instanceof Date ? dateValue : new Date(dateValue);
2506
+ const hasAwardOffset = validAwardedDate && (awardDateText.includes("T") || awardDateText.includes(" ")) && /(?:Z|[+-]\d{2}(?::?\d{2})?)$/i.test(awardDateText.slice(-6));
2507
+ const displayDate = validAwardedDate && hasAwardOffset ? new Date(date.getUTCFullYear(), date.getUTCMonth(), date.getUTCDate()) : date;
2508
+ createdAt = format(displayDate, dateFormat);
2275
2509
  if (options.uppercaseDate) {
2276
2510
  createdAt = createdAt.toUpperCase();
2277
2511
  }
@@ -2444,4 +2678,4 @@ const getTotalCountOfSkills = (skills) => {
2444
2678
  };
2445
2679
 
2446
2680
  export { getColorForVerificationStatus as a, getInfoFromCredential as b, categorizeSkills as c, getCategoryDarkColor as d, getCategoryLightColor as e, getCategoryIcon as f, getTotalCountOfSkills as g, getImageFromProfile as h, getNameFromProfile as i, format as j, getCategoryColor as k };
2447
- //# sourceMappingURL=credential.helpers-f55a4962.js.map
2681
+ //# sourceMappingURL=credential.helpers-4c72d304.js.map