@primer/react 37.11.1 → 37.11.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.
@@ -32,7 +32,6 @@ class Duration {
32
32
  this.milliseconds || (this.milliseconds = 0);
33
33
  this.sign || (this.sign = Math.sign(this.milliseconds));
34
34
  this.blank = this.sign === 0;
35
- console.log("heyyyy");
36
35
  }
37
36
  abs() {
38
37
  return new Duration(Math.abs(this.years), Math.abs(this.months), Math.abs(this.weeks), Math.abs(this.days), Math.abs(this.hours), Math.abs(this.minutes), Math.abs(this.seconds), Math.abs(this.milliseconds));
@@ -55,7 +54,7 @@ class Duration {
55
54
  throw new RangeError('invalid duration');
56
55
  }
57
56
  static compare(one, two) {
58
- const now = 1733097600000;
57
+ const now = Date.now();
59
58
  const oneApplied = Math.abs(applyDuration(now, Duration.from(one)).getTime() - now);
60
59
  const twoApplied = Math.abs(applyDuration(now, Duration.from(two)).getTime() - now);
61
60
  return oneApplied > twoApplied ? -1 : oneApplied < twoApplied ? 1 : 0;
@@ -74,7 +73,7 @@ function applyDuration(date, duration) {
74
73
  r.setSeconds(r.getSeconds() + duration.seconds);
75
74
  return r;
76
75
  }
77
- function elapsedTime(date, precision = 'second', now = 1733097600000) {
76
+ function elapsedTime(date, precision = 'second', now = Date.now()) {
78
77
  const delta = date.getTime() - now;
79
78
  if (delta === 0)
80
79
  return new Duration();
@@ -89,7 +88,7 @@ function elapsedTime(date, precision = 'second', now = 1733097600000) {
89
88
  const i = unitNames.indexOf(precision) || unitNames.length;
90
89
  return new Duration(i >= 0 ? year * sign : 0, i >= 1 ? (month - year * 12) * sign : 0, 0, i >= 3 ? (day - month * 30) * sign : 0, i >= 4 ? (hr - day * 24) * sign : 0, i >= 5 ? (min - hr * 60) * sign : 0, i >= 6 ? (sec - min * 60) * sign : 0, i >= 7 ? (ms - sec * 1000) * sign : 0);
91
90
  }
92
- function roundToSingleUnit(duration, { relativeTo = 1733097600000 } = {}) {
91
+ function roundToSingleUnit(duration, { relativeTo = Date.now() } = {}) {
93
92
  relativeTo = new Date(relativeTo);
94
93
  if (duration.blank)
95
94
  return duration;
@@ -5,9 +5,7 @@ Object.defineProperty(exports, '__esModule', { value: true });
5
5
  var relativeTimeElement = require('./relative-time-element.js');
6
6
 
7
7
  const root = (typeof globalThis !== 'undefined' ? globalThis : window);
8
- console.log("ooooop");
9
8
  try {
10
- console.log("heyyyy");
11
9
  root.RelativeTimeElement = relativeTimeElement.RelativeTimeElement.define();
12
10
  }
13
11
  catch (e) {
@@ -40,7 +40,7 @@ function getUnitFactor(el) {
40
40
  return 60 * 1000;
41
41
  }
42
42
  }
43
- const ms = Math.abs(1733097600000 - el.date.getTime());
43
+ const ms = Math.abs(Date.now() - el.date.getTime());
44
44
  if (ms < 60 * 1000)
45
45
  return 1000;
46
46
  if (ms < 60 * 60 * 1000)
@@ -52,7 +52,6 @@ const dateObserver = new (class {
52
52
  this.elements = new Set();
53
53
  this.time = Infinity;
54
54
  this.timer = -1;
55
- console.log("heyyyy");
56
55
  }
57
56
  observe(element) {
58
57
  if (this.elements.has(element))
@@ -61,7 +60,7 @@ const dateObserver = new (class {
61
60
  const date = element.date;
62
61
  if (date && date.getTime()) {
63
62
  const ms = getUnitFactor(element);
64
- const time = 1733097600000 + ms;
63
+ const time = Date.now() + ms;
65
64
  if (time < this.time) {
66
65
  clearTimeout(this.timer);
67
66
  this.timer = setTimeout(() => this.update(), ms);
@@ -85,7 +84,7 @@ const dateObserver = new (class {
85
84
  }
86
85
  this.time = Math.min(60 * 60 * 1000, nearestDistance);
87
86
  this.timer = setTimeout(() => this.update(), this.time);
88
- this.time += 1733097600000;
87
+ this.time += Date.now();
89
88
  }
90
89
  })();
91
90
  class RelativeTimeElement extends HTMLElement {
@@ -96,7 +95,6 @@ class RelativeTimeElement extends HTMLElement {
96
95
  _RelativeTimeElement_updating.set(this, false);
97
96
  _RelativeTimeElement_renderRoot.set(this, this.shadowRoot ? this.shadowRoot : this.attachShadow ? this.attachShadow({ mode: 'open' }) : this);
98
97
  _RelativeTimeElement_onRelativeTimeUpdated.set(this, null);
99
- console.log("ahhh");
100
98
  }
101
99
  static define(tag = 'relative-time', registry = customElements) {
102
100
  registry.define(tag, this);
@@ -338,7 +336,7 @@ class RelativeTimeElement extends HTMLElement {
338
336
  __classPrivateFieldGet(this, _RelativeTimeElement_renderRoot, "f").textContent = oldText;
339
337
  return;
340
338
  }
341
- const now = 1733097600000;
339
+ const now = Date.now();
342
340
  if (!__classPrivateFieldGet(this, _RelativeTimeElement_customTitle, "f")) {
343
341
  newTitle = __classPrivateFieldGet(this, _RelativeTimeElement_instances, "m", _RelativeTimeElement_getFormattedTitle).call(this, date) || '';
344
342
  if (newTitle && !this.noTitle)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@primer/react",
3
- "version": "37.11.1",
3
+ "version": "37.11.2",
4
4
  "description": "An implementation of GitHub's Primer Design System using React",
5
5
  "main": "lib/index.js",
6
6
  "module": "lib-esm/index.js",