Skip to content

Commit

Permalink
Nullish coalescing operator
Browse files Browse the repository at this point in the history
  • Loading branch information
bjarnef committed Aug 5, 2024
1 parent d55f579 commit 3c37dc0
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions packages/uui-relative-time/lib/uui-relative-time.element.ts
Original file line number Diff line number Diff line change
Expand Up @@ -451,8 +451,8 @@ export class UUIRelativeTimeElement

update() {
const oldText: string =
this.#renderRoot.textContent || this.textContent || '';
const oldTitle: string = this.getAttribute('title') || '';
this.#renderRoot.textContent ?? this.textContent ?? '';
const oldTitle: string = this.getAttribute('title') ?? '';
let newTitle: string = oldTitle;
const date = this.date;
if (typeof Intl === 'undefined' || !Intl.DateTimeFormat || !date) {
Expand All @@ -461,7 +461,7 @@ export class UUIRelativeTimeElement
}
const now = Date.now();
if (!this.#customTitle) {
newTitle = this.#getFormattedTitle(date) || '';
newTitle = this.#getFormattedTitle(date) ?? '';
if (newTitle && !this.noTitle) this.setAttribute('title', newTitle);
}

Expand Down

0 comments on commit 3c37dc0

Please sign in to comment.