DEV: Fix typos "formated" -> "formatted" (#17156)

(nothing in all-the* relies on these)
This commit is contained in:
Jarek Radosz 2022-06-20 20:02:05 +02:00 committed by GitHub
parent 95a6268c45
commit 36c2284dea
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
15 changed files with 98 additions and 96 deletions

View File

@ -16,6 +16,6 @@ export default Component.extend({
type: alias("label.type"), type: alias("label.type"),
property: alias("label.mainProperty"), property: alias("label.mainProperty"),
formatedValue: alias("computedLabel.formatedValue"), formattedValue: alias("computedLabel.formattedValue"),
value: alias("computedLabel.value"), value: alias("computedLabel.value"),
}); });

View File

@ -354,7 +354,7 @@ const Report = EmberObject.extend({
value, value,
type, type,
property: mainProperty, property: mainProperty,
formatedValue: value ? escapeExpression(value) : "—", formattedValue: value ? escapeExpression(value) : "—",
}; };
}, },
}; };
@ -364,7 +364,7 @@ const Report = EmberObject.extend({
_userLabel(properties, row) { _userLabel(properties, row) {
const username = row[properties.username]; const username = row[properties.username];
const formatedValue = () => { const formattedValue = () => {
const userId = row[properties.id]; const userId = row[properties.id];
const user = EmberObject.create({ const user = EmberObject.create({
@ -386,14 +386,14 @@ const Report = EmberObject.extend({
return { return {
value: username, value: username,
formatedValue: username ? formatedValue() : "—", formattedValue: username ? formattedValue() : "—",
}; };
}, },
_topicLabel(properties, row) { _topicLabel(properties, row) {
const topicTitle = row[properties.title]; const topicTitle = row[properties.title];
const formatedValue = () => { const formattedValue = () => {
const topicId = row[properties.id]; const topicId = row[properties.id];
const href = getURL(`/t/-/${topicId}`); const href = getURL(`/t/-/${topicId}`);
return `<a href='${href}'>${escapeExpression(topicTitle)}</a>`; return `<a href='${href}'>${escapeExpression(topicTitle)}</a>`;
@ -401,7 +401,7 @@ const Report = EmberObject.extend({
return { return {
value: topicTitle, value: topicTitle,
formatedValue: topicTitle ? formatedValue() : "—", formattedValue: topicTitle ? formattedValue() : "—",
}; };
}, },
@ -414,7 +414,7 @@ const Report = EmberObject.extend({
return { return {
property: properties.title, property: properties.title,
value: postTitle, value: postTitle,
formatedValue: formattedValue:
postTitle && href postTitle && href
? `<a href='${href}'>${escapeExpression(postTitle)}</a>` ? `<a href='${href}'>${escapeExpression(postTitle)}</a>`
: "—", : "—",
@ -424,14 +424,14 @@ const Report = EmberObject.extend({
_secondsLabel(value) { _secondsLabel(value) {
return { return {
value: toNumber(value), value: toNumber(value),
formatedValue: durationTiny(value), formattedValue: durationTiny(value),
}; };
}, },
_percentLabel(value) { _percentLabel(value) {
return { return {
value: toNumber(value), value: toNumber(value),
formatedValue: value ? `${value}%` : "—", formattedValue: value ? `${value}%` : "—",
}; };
}, },
@ -440,25 +440,25 @@ const Report = EmberObject.extend({
? true ? true
: options.formatNumbers; : options.formatNumbers;
const formatedValue = () => (formatNumbers ? number(value) : value); const formattedValue = () => (formatNumbers ? number(value) : value);
return { return {
value: toNumber(value), value: toNumber(value),
formatedValue: value ? formatedValue() : "—", formattedValue: value ? formattedValue() : "—",
}; };
}, },
_bytesLabel(value) { _bytesLabel(value) {
return { return {
value: toNumber(value), value: toNumber(value),
formatedValue: I18n.toHumanSize(value), formattedValue: I18n.toHumanSize(value),
}; };
}, },
_dateLabel(value, date, format = "LL") { _dateLabel(value, date, format = "LL") {
return { return {
value, value,
formatedValue: value ? date.format(format) : "—", formattedValue: value ? date.format(format) : "—",
}; };
}, },
@ -467,14 +467,14 @@ const Report = EmberObject.extend({
return { return {
value, value,
formatedValue: value ? escaped : "—", formattedValue: value ? escaped : "—",
}; };
}, },
_linkLabel(properties, row) { _linkLabel(properties, row) {
const property = properties[0]; const property = properties[0];
const value = getURL(row[property]); const value = getURL(row[property]);
const formatedValue = (href, anchor) => { const formattedValue = (href, anchor) => {
return `<a href="${escapeExpression(href)}">${escapeExpression( return `<a href="${escapeExpression(href)}">${escapeExpression(
anchor anchor
)}</a>`; )}</a>`;
@ -482,7 +482,7 @@ const Report = EmberObject.extend({
return { return {
value, value,
formatedValue: value ? formatedValue(value, row[properties[1]]) : "—", formattedValue: value ? formattedValue(value, row[properties[1]]) : "—",
}; };
}, },

View File

@ -1 +1 @@
{{html-safe formatedValue}} {{html-safe formattedValue}}

View File

@ -31,7 +31,7 @@
<tr class="admin-report-table-row"> <tr class="admin-report-table-row">
{{#each totalsForSample as |total|}} {{#each totalsForSample as |total|}}
<td class="admin-report-table-cell {{total.type}} {{total.property}}"> <td class="admin-report-table-cell {{total.type}} {{total.property}}">
{{total.formatedValue}} {{total.formattedValue}}
</td> </td>
{{/each}} {{/each}}
</tr> </tr>

View File

@ -22,7 +22,7 @@ discourseModule(
async test(assert) { async test(assert) {
assert.strictEqual( assert.strictEqual(
query(".formated-selection").innerText, query(".formatted-selection").innerText,
"a.com, b.com" "a.com, b.com"
); );
}, },

View File

@ -480,7 +480,7 @@ module("Unit | Model | report", function () {
assert.strictEqual(usernameLabel.type, "user"); assert.strictEqual(usernameLabel.type, "user");
const computedUsernameLabel = usernameLabel.compute(row); const computedUsernameLabel = usernameLabel.compute(row);
assert.strictEqual( assert.strictEqual(
computedUsernameLabel.formatedValue, computedUsernameLabel.formattedValue,
"<a href='/admin/users/1/joffrey'><img loading='lazy' alt='' width='20' height='20' src='/' class='avatar' title='joffrey' aria-label='joffrey'><span class='username'>joffrey</span></a>" "<a href='/admin/users/1/joffrey'><img loading='lazy' alt='' width='20' height='20' src='/' class='avatar' title='joffrey' aria-label='joffrey'><span class='username'>joffrey</span></a>"
); );
assert.strictEqual(computedUsernameLabel.value, "joffrey"); assert.strictEqual(computedUsernameLabel.value, "joffrey");
@ -491,12 +491,12 @@ module("Unit | Model | report", function () {
assert.strictEqual(flagCountLabel.title, "Flag count"); assert.strictEqual(flagCountLabel.title, "Flag count");
assert.strictEqual(flagCountLabel.type, "number"); assert.strictEqual(flagCountLabel.type, "number");
let computedFlagCountLabel = flagCountLabel.compute(row); let computedFlagCountLabel = flagCountLabel.compute(row);
assert.strictEqual(computedFlagCountLabel.formatedValue, "1.9k"); assert.strictEqual(computedFlagCountLabel.formattedValue, "1.9k");
assert.strictEqual(computedFlagCountLabel.value, 1876); assert.strictEqual(computedFlagCountLabel.value, 1876);
computedFlagCountLabel = flagCountLabel.compute(row, { computedFlagCountLabel = flagCountLabel.compute(row, {
formatNumbers: false, formatNumbers: false,
}); });
assert.strictEqual(computedFlagCountLabel.formatedValue, "1876"); assert.strictEqual(computedFlagCountLabel.formattedValue, "1876");
const timeReadLabel = computedLabels[2]; const timeReadLabel = computedLabels[2];
assert.strictEqual(timeReadLabel.mainProperty, "time_read"); assert.strictEqual(timeReadLabel.mainProperty, "time_read");
@ -504,7 +504,7 @@ module("Unit | Model | report", function () {
assert.strictEqual(timeReadLabel.title, "Time read"); assert.strictEqual(timeReadLabel.title, "Time read");
assert.strictEqual(timeReadLabel.type, "seconds"); assert.strictEqual(timeReadLabel.type, "seconds");
const computedTimeReadLabel = timeReadLabel.compute(row); const computedTimeReadLabel = timeReadLabel.compute(row);
assert.strictEqual(computedTimeReadLabel.formatedValue, "3d"); assert.strictEqual(computedTimeReadLabel.formattedValue, "3d");
assert.strictEqual(computedTimeReadLabel.value, 287362); assert.strictEqual(computedTimeReadLabel.value, 287362);
const noteLabel = computedLabels[3]; const noteLabel = computedLabels[3];
@ -513,7 +513,7 @@ module("Unit | Model | report", function () {
assert.strictEqual(noteLabel.title, "Note"); assert.strictEqual(noteLabel.title, "Note");
assert.strictEqual(noteLabel.type, "text"); assert.strictEqual(noteLabel.type, "text");
const computedNoteLabel = noteLabel.compute(row); const computedNoteLabel = noteLabel.compute(row);
assert.strictEqual(computedNoteLabel.formatedValue, "This is a long note"); assert.strictEqual(computedNoteLabel.formattedValue, "This is a long note");
assert.strictEqual(computedNoteLabel.value, "This is a long note"); assert.strictEqual(computedNoteLabel.value, "This is a long note");
const topicLabel = computedLabels[4]; const topicLabel = computedLabels[4];
@ -523,7 +523,7 @@ module("Unit | Model | report", function () {
assert.strictEqual(topicLabel.type, "topic"); assert.strictEqual(topicLabel.type, "topic");
const computedTopicLabel = topicLabel.compute(row); const computedTopicLabel = topicLabel.compute(row);
assert.strictEqual( assert.strictEqual(
computedTopicLabel.formatedValue, computedTopicLabel.formattedValue,
"<a href='/t/-/2'>Test topic &lt;html&gt;</a>" "<a href='/t/-/2'>Test topic &lt;html&gt;</a>"
); );
assert.strictEqual(computedTopicLabel.value, "Test topic <html>"); assert.strictEqual(computedTopicLabel.value, "Test topic <html>");
@ -535,7 +535,7 @@ module("Unit | Model | report", function () {
assert.strictEqual(postLabel.type, "post"); assert.strictEqual(postLabel.type, "post");
const computedPostLabel = postLabel.compute(row); const computedPostLabel = postLabel.compute(row);
assert.strictEqual( assert.strictEqual(
computedPostLabel.formatedValue, computedPostLabel.formattedValue,
"<a href='/t/-/2/3'>This is the beginning of &lt;html&gt;</a>" "<a href='/t/-/2/3'>This is the beginning of &lt;html&gt;</a>"
); );
assert.strictEqual( assert.strictEqual(
@ -549,25 +549,25 @@ module("Unit | Model | report", function () {
assert.strictEqual(filesizeLabel.title, "Filesize"); assert.strictEqual(filesizeLabel.title, "Filesize");
assert.strictEqual(filesizeLabel.type, "bytes"); assert.strictEqual(filesizeLabel.type, "bytes");
const computedFilesizeLabel = filesizeLabel.compute(row); const computedFilesizeLabel = filesizeLabel.compute(row);
assert.strictEqual(computedFilesizeLabel.formatedValue, "569.0 KB"); assert.strictEqual(computedFilesizeLabel.formattedValue, "569.0 KB");
assert.strictEqual(computedFilesizeLabel.value, 582641); assert.strictEqual(computedFilesizeLabel.value, 582641);
// subfolder support // subfolder support
setPrefix("/forum"); setPrefix("/forum");
const postLink = computedLabels[5].compute(row).formatedValue; const postLink = computedLabels[5].compute(row).formattedValue;
assert.strictEqual( assert.strictEqual(
postLink, postLink,
"<a href='/forum/t/-/2/3'>This is the beginning of &lt;html&gt;</a>" "<a href='/forum/t/-/2/3'>This is the beginning of &lt;html&gt;</a>"
); );
const topicLink = computedLabels[4].compute(row).formatedValue; const topicLink = computedLabels[4].compute(row).formattedValue;
assert.strictEqual( assert.strictEqual(
topicLink, topicLink,
"<a href='/forum/t/-/2'>Test topic &lt;html&gt;</a>" "<a href='/forum/t/-/2'>Test topic &lt;html&gt;</a>"
); );
const userLink = computedLabels[0].compute(row).formatedValue; const userLink = computedLabels[0].compute(row).formattedValue;
assert.strictEqual( assert.strictEqual(
userLink, userLink,
"<a href='/forum/admin/users/1/joffrey'><img loading='lazy' alt='' width='20' height='20' src='/forum/' class='avatar' title='joffrey' aria-label='joffrey'><span class='username'>joffrey</span></a>" "<a href='/forum/admin/users/1/joffrey'><img loading='lazy' alt='' width='20' height='20' src='/forum/' class='avatar' title='joffrey' aria-label='joffrey'><span class='username'>joffrey</span></a>"

View File

@ -10,7 +10,7 @@ export default Component.extend(UtilsMixin, {
content: null, content: null,
selectKit: null, selectKit: null,
formatedContent: computed("content", function () { formattedContent: computed("content", function () {
if (this.content) { if (this.content) {
return makeArray(this.content) return makeArray(this.content)
.map((c) => this.getName(c)) .map((c) => this.getName(c))

View File

@ -1,3 +1,3 @@
<span class="formated-selection"> <span class="formatted-selection">
{{formatedContent}} {{formattedContent}}
</span> </span>

View File

@ -49,7 +49,7 @@
background: var(--secondary); background: var(--secondary);
border-color: var(--primary-medium); border-color: var(--primary-medium);
.formated-selection { .formatted-selection {
margin: 0; margin: 0;
cursor: pointer; cursor: pointer;
@include ellipsis; @include ellipsis;

View File

@ -203,7 +203,7 @@
} }
} }
.formated-selection { .formatted-selection {
font-size: var(--font-down-1); font-size: var(--font-down-1);
} }
} }

View File

@ -207,7 +207,7 @@ export default Component.extend({
), ),
@computed("currentUserTimezone") @computed("currentUserTimezone")
formatedCurrentUserTimezone(timezone) { formattedCurrentUserTimezone(timezone) {
return timezone.replace("_", " ").replace("Etc/", "").replace("/", ", "); return timezone.replace("_", " ").replace("Etc/", "").replace("/", ", ");
}, },

View File

@ -8,7 +8,7 @@
{{#if timezoneIsDifferentFromUserTimezone}} {{#if timezoneIsDifferentFromUserTimezone}}
<div class="preview alert alert-info"> <div class="preview alert alert-info">
{{i18n "discourse_local_dates.create.form.current_timezone"}} {{i18n "discourse_local_dates.create.form.current_timezone"}}
<b>{{formatedCurrentUserTimezone}}</b>{{currentPreview}} <b>{{formattedCurrentUserTimezone}}</b>{{currentPreview}}
</div> </div>
{{/if}} {{/if}}
{{else}} {{else}}

View File

@ -27,7 +27,7 @@ export function applyLocalDates(dates, siteSettings) {
<svg class="fa d-icon d-icon-globe-americas svg-icon" xmlns="http://www.w3.org/2000/svg"> <svg class="fa d-icon d-icon-globe-americas svg-icon" xmlns="http://www.w3.org/2000/svg">
<use href="#globe-americas"></use> <use href="#globe-americas"></use>
</svg> </svg>
<span class="relative-time">${localDateBuilder.formated}</span> <span class="relative-time">${localDateBuilder.formatted}</span>
` `
); );
element.setAttribute("aria-label", localDateBuilder.textPreview); element.setAttribute("aria-label", localDateBuilder.textPreview);
@ -151,7 +151,7 @@ function buildHtmlPreview(element, siteSettings) {
const dateTimeNode = document.createElement("span"); const dateTimeNode = document.createElement("span");
dateTimeNode.classList.add("date-time"); dateTimeNode.classList.add("date-time");
dateTimeNode.innerHTML = preview.formated; dateTimeNode.innerHTML = preview.formatted;
previewNode.appendChild(dateTimeNode); previewNode.appendChild(dateTimeNode);
return previewNode; return previewNode;

View File

@ -71,7 +71,7 @@ export default class LocalDateBuilder {
pastEvent: pastEvent:
!this.recurring && !this.recurring &&
moment.tz(this.localTimezone).isAfter(localDate.datetime), moment.tz(this.localTimezone).isAfter(localDate.datetime),
formated: this._applyFormatting(localDate, displayedTimezone), formatted: this._applyFormatting(localDate, displayedTimezone),
previews, previews,
textPreview: this._generateTextPreviews(previews), textPreview: this._generateTextPreviews(previews),
}; };
@ -80,8 +80,8 @@ export default class LocalDateBuilder {
_generateTextPreviews(previews) { _generateTextPreviews(previews) {
return previews return previews
.map((preview) => { .map((preview) => {
const formatedZone = this._zoneWithoutPrefix(preview.timezone); const formattedZone = this._zoneWithoutPrefix(preview.timezone);
return `${formatedZone} ${preview.formated}`; return `${formattedZone} ${preview.formatted}`;
}) })
.join(", "); .join(", ");
} }
@ -96,7 +96,7 @@ export default class LocalDateBuilder {
previewedTimezones.push({ previewedTimezones.push({
timezone: this._zoneWithoutPrefix(this.localTimezone), timezone: this._zoneWithoutPrefix(this.localTimezone),
current: true, current: true,
formated: this._createDateTimeRange( formatted: this._createDateTimeRange(
DateWithZoneHelper.fromDatetime( DateWithZoneHelper.fromDatetime(
localDate.datetime, localDate.datetime,
localDate.timezone, localDate.timezone,
@ -128,7 +128,7 @@ export default class LocalDateBuilder {
previewedTimezones.push({ previewedTimezones.push({
timezone: this._zoneWithoutPrefix(timezone), timezone: this._zoneWithoutPrefix(timezone),
formated: this._createDateTimeRange( formatted: this._createDateTimeRange(
DateWithZoneHelper.fromDatetime( DateWithZoneHelper.fromDatetime(
localDate.datetime, localDate.datetime,
localDate.timezone, localDate.timezone,
@ -288,7 +288,9 @@ export default class LocalDateBuilder {
} }
_formatWithZone(localDate, displayedTimezone, format) { _formatWithZone(localDate, displayedTimezone, format) {
let formated = localDate.datetimeWithZone(displayedTimezone).format(format); let formatted = localDate
return `${formated} (${this._zoneWithoutPrefix(displayedTimezone)})`; .datetimeWithZone(displayedTimezone)
.format(format);
return `${formatted} (${this._zoneWithoutPrefix(displayedTimezone)})`;
} }
} }

View File

@ -44,10 +44,10 @@ QUnit.assert.buildsCorrectDate = function (options, expected, message) {
localTimezone localTimezone
); );
if (expected.formated) { if (expected.formatted) {
this.test.assert.strictEqual( this.test.assert.strictEqual(
localDateBuilder.build().formated, localDateBuilder.build().formatted,
expected.formated, expected.formatted,
message || "it formats the date correctly" message || "it formats the date correctly"
); );
} }
@ -66,7 +66,7 @@ module("lib:local-date-builder", function () {
freezeTime({ date: "2020-03-11" }, () => { freezeTime({ date: "2020-03-11" }, () => {
assert.buildsCorrectDate( assert.buildsCorrectDate(
{ date: "2020-03-22", timezone: PARIS }, { date: "2020-03-22", timezone: PARIS },
{ formated: "March 22, 2020" }, { formatted: "March 22, 2020" },
"it displays the date without time" "it displays the date without time"
); );
}); });
@ -75,13 +75,13 @@ module("lib:local-date-builder", function () {
test("date and time", function (assert) { test("date and time", function (assert) {
assert.buildsCorrectDate( assert.buildsCorrectDate(
{ date: "2020-04-11", time: "11:00" }, { date: "2020-04-11", time: "11:00" },
{ formated: "April 11, 2020 1:00 PM" }, { formatted: "April 11, 2020 1:00 PM" },
"it displays the date with time" "it displays the date with time"
); );
assert.buildsCorrectDate( assert.buildsCorrectDate(
{ date: "2020-04-11", time: "11:05:12", format: "LTS" }, { date: "2020-04-11", time: "11:05:12", format: "LTS" },
{ formated: "1:05:12 PM" }, { formatted: "1:05:12 PM" },
"it displays full time (hours, minutes, seconds)" "it displays full time (hours, minutes, seconds)"
); );
}); });
@ -90,7 +90,7 @@ module("lib:local-date-builder", function () {
freezeTime({ date: "2020-03-11" }, () => { freezeTime({ date: "2020-03-11" }, () => {
assert.buildsCorrectDate( assert.buildsCorrectDate(
{ format: "YYYY" }, { format: "YYYY" },
{ formated: "2020 (UTC)" }, { formatted: "2020 (UTC)" },
"it uses custom format" "it uses custom format"
); );
}); });
@ -100,7 +100,7 @@ module("lib:local-date-builder", function () {
freezeTime({}, () => { freezeTime({}, () => {
assert.buildsCorrectDate( assert.buildsCorrectDate(
{ displayedTimezone: SYDNEY }, { displayedTimezone: SYDNEY },
{ formated: "March 22, 2020 (Sydney)" }, { formatted: "March 22, 2020 (Sydney)" },
"it displays the timezone if the timezone is different from the date" "it displays the timezone if the timezone is different from the date"
); );
}); });
@ -108,7 +108,7 @@ module("lib:local-date-builder", function () {
freezeTime({}, () => { freezeTime({}, () => {
assert.buildsCorrectDate( assert.buildsCorrectDate(
{ displayedTimezone: PARIS, timezone: PARIS }, { displayedTimezone: PARIS, timezone: PARIS },
{ formated: "March 22, 2020" }, { formatted: "March 22, 2020" },
"it doesn't display the timezone if the timezone is the same than the date" "it doesn't display the timezone if the timezone is the same than the date"
); );
}); });
@ -116,7 +116,7 @@ module("lib:local-date-builder", function () {
freezeTime({}, () => { freezeTime({}, () => {
assert.buildsCorrectDate( assert.buildsCorrectDate(
{ timezone: UTC, displayedTimezone: UTC }, { timezone: UTC, displayedTimezone: UTC },
{ formated: "March 22, 2020 (UTC)" }, { formatted: "March 22, 2020 (UTC)" },
"it replaces `Etc/`" "it replaces `Etc/`"
); );
}); });
@ -124,7 +124,7 @@ module("lib:local-date-builder", function () {
freezeTime({}, () => { freezeTime({}, () => {
assert.buildsCorrectDate( assert.buildsCorrectDate(
{ timezone: LOS_ANGELES, displayedTimezone: LOS_ANGELES }, { timezone: LOS_ANGELES, displayedTimezone: LOS_ANGELES },
{ formated: "March 22, 2020 (Los Angeles)" }, { formatted: "March 22, 2020 (Los Angeles)" },
"it removes prefix and replaces `_`" "it removes prefix and replaces `_`"
); );
}); });
@ -134,7 +134,7 @@ module("lib:local-date-builder", function () {
freezeTime({}, () => { freezeTime({}, () => {
assert.buildsCorrectDate( assert.buildsCorrectDate(
{ timezone: SYDNEY, displayedTimezone: PARIS }, { timezone: SYDNEY, displayedTimezone: PARIS },
{ formated: "March 21, 2020" }, { formatted: "March 21, 2020" },
"it correctly parses a date with the given timezone context" "it correctly parses a date with the given timezone context"
); );
}); });
@ -151,7 +151,7 @@ module("lib:local-date-builder", function () {
recurring: "1.weeks", recurring: "1.weeks",
}, },
{ {
formated: "April 6, 2020 10:00 AM (Lagos)", formatted: "April 6, 2020 10:00 AM (Lagos)",
}, },
"it correctly formats a recurring date starting from a !isDST timezone to a isDST timezone date when displayed to a user using a timezone with no DST" "it correctly formats a recurring date starting from a !isDST timezone to a isDST timezone date when displayed to a user using a timezone with no DST"
); );
@ -168,7 +168,7 @@ module("lib:local-date-builder", function () {
displayedTimezone: SYDNEY, displayedTimezone: SYDNEY,
}, },
{ {
formated: "April 6, 2020 12:00 PM (Sydney)", formatted: "April 6, 2020 12:00 PM (Sydney)",
}, },
"it correctly formats a recurring date spanning over weeks" "it correctly formats a recurring date spanning over weeks"
); );
@ -183,7 +183,7 @@ module("lib:local-date-builder", function () {
timezone: PARIS, timezone: PARIS,
}, },
{ {
formated: "April 13, 2020 11:00 AM", formatted: "April 13, 2020 11:00 AM",
}, },
"it correctly adds from a !isDST date to a isDST date" "it correctly adds from a !isDST date to a isDST date"
); );
@ -198,7 +198,7 @@ module("lib:local-date-builder", function () {
timezone: PARIS, timezone: PARIS,
}, },
{ {
formated: "Today 11:00 AM", formatted: "Today 11:00 AM",
}, },
"it works to the minute" "it works to the minute"
); );
@ -213,7 +213,7 @@ module("lib:local-date-builder", function () {
timezone: PARIS, timezone: PARIS,
}, },
{ {
formated: "April 13, 2020 11:00 AM", formatted: "April 13, 2020 11:00 AM",
}, },
"it works to the minute" "it works to the minute"
); );
@ -228,7 +228,7 @@ module("lib:local-date-builder", function () {
timezone: NEW_YORK, timezone: NEW_YORK,
}, },
{ {
formated: "January 24, 2021 2:30 PM", formatted: "January 24, 2021 2:30 PM",
}, },
"it works for a future date" "it works for a future date"
); );
@ -243,7 +243,7 @@ module("lib:local-date-builder", function () {
timezone: NEW_YORK, timezone: NEW_YORK,
}, },
{ {
formated: "Today 12:00 PM", formatted: "Today 12:00 PM",
}, },
"it works with hours" "it works with hours"
); );
@ -257,7 +257,7 @@ module("lib:local-date-builder", function () {
countdown: true, countdown: true,
timezone: PARIS, timezone: PARIS,
}, },
{ formated: "a minute" }, { formatted: "a minute" },
"it shows the time remaining" "it shows the time remaining"
); );
}); });
@ -269,7 +269,7 @@ module("lib:local-date-builder", function () {
timezone: PARIS, timezone: PARIS,
}, },
{ {
formated: I18n.t( formatted: I18n.t(
"discourse_local_dates.relative_dates.countdown.passed" "discourse_local_dates.relative_dates.countdown.passed"
), ),
}, },
@ -282,7 +282,7 @@ module("lib:local-date-builder", function () {
freezeTime({ date: "2020-03-23 23:00" }, () => { freezeTime({ date: "2020-03-23 23:00" }, () => {
assert.buildsCorrectDate( assert.buildsCorrectDate(
{ date: "2020-03-22", time: "23:59", timezone: PARIS }, { date: "2020-03-22", time: "23:59", timezone: PARIS },
{ formated: "Yesterday 11:59 PM" }, { formatted: "Yesterday 11:59 PM" },
"it drops calendar mode when event date is more than one day before current date" "it drops calendar mode when event date is more than one day before current date"
); );
}); });
@ -290,14 +290,14 @@ module("lib:local-date-builder", function () {
freezeTime({ date: "2020-03-20 23:59" }, () => freezeTime({ date: "2020-03-20 23:59" }, () =>
assert.buildsCorrectDate( assert.buildsCorrectDate(
{ date: "2020-03-21", time: "01:00", timezone: PARIS }, { date: "2020-03-21", time: "01:00", timezone: PARIS },
{ formated: "Tomorrow 1:00 AM" } { formatted: "Tomorrow 1:00 AM" }
) )
); );
freezeTime({ date: "2020-03-20 23:59" }, () => freezeTime({ date: "2020-03-20 23:59" }, () =>
assert.buildsCorrectDate( assert.buildsCorrectDate(
{ date: "2020-03-21", time: "00:00", timezone: PARIS }, { date: "2020-03-21", time: "00:00", timezone: PARIS },
{ formated: "Saturday" }, { formatted: "Saturday" },
"it displays the day with no time when the time in the displayed timezone is 00:00" "it displays the day with no time when the time in the displayed timezone is 00:00"
) )
); );
@ -305,35 +305,35 @@ module("lib:local-date-builder", function () {
freezeTime({ date: "2020-03-20 23:59" }, () => { freezeTime({ date: "2020-03-20 23:59" }, () => {
assert.buildsCorrectDate( assert.buildsCorrectDate(
{ date: "2020-03-21", time: "23:59", timezone: PARIS }, { date: "2020-03-21", time: "23:59", timezone: PARIS },
{ formated: "Tomorrow 11:59 PM" } { formatted: "Tomorrow 11:59 PM" }
); );
}); });
freezeTime({ date: "2020-03-21 00:00" }, () => freezeTime({ date: "2020-03-21 00:00" }, () =>
assert.buildsCorrectDate( assert.buildsCorrectDate(
{ date: "2020-03-21", time: "23:00", timezone: PARIS }, { date: "2020-03-21", time: "23:00", timezone: PARIS },
{ formated: "Today 11:00 PM" } { formatted: "Today 11:00 PM" }
) )
); );
freezeTime({ date: "2020-03-22 23:59" }, () => freezeTime({ date: "2020-03-22 23:59" }, () =>
assert.buildsCorrectDate( assert.buildsCorrectDate(
{ date: "2020-03-21", time: "23:59", timezone: PARIS }, { date: "2020-03-21", time: "23:59", timezone: PARIS },
{ formated: "Yesterday 11:59 PM" } { formatted: "Yesterday 11:59 PM" }
) )
); );
freezeTime({ date: "2020-03-22 23:59" }, () => freezeTime({ date: "2020-03-22 23:59" }, () =>
assert.buildsCorrectDate( assert.buildsCorrectDate(
{ date: "2020-03-21", time: "23:59", timezone: PARIS }, { date: "2020-03-21", time: "23:59", timezone: PARIS },
{ formated: "Yesterday 11:59 PM" } { formatted: "Yesterday 11:59 PM" }
) )
); );
freezeTime({ date: "2020-03-22 23:59" }, () => freezeTime({ date: "2020-03-22 23:59" }, () =>
assert.buildsCorrectDate( assert.buildsCorrectDate(
{ calendar: false, date: "2020-03-21", time: "23:59", timezone: PARIS }, { calendar: false, date: "2020-03-21", time: "23:59", timezone: PARIS },
{ formated: "March 21, 2020 11:59 PM" }, { formatted: "March 21, 2020 11:59 PM" },
"it doesn't use calendar when disabled" "it doesn't use calendar when disabled"
) )
); );
@ -341,7 +341,7 @@ module("lib:local-date-builder", function () {
freezeTime({ date: "2020-03-24 01:00" }, () => freezeTime({ date: "2020-03-24 01:00" }, () =>
assert.buildsCorrectDate( assert.buildsCorrectDate(
{ date: "2020-03-21", timezone: PARIS }, { date: "2020-03-21", timezone: PARIS },
{ formated: "March 21, 2020" }, { formatted: "March 21, 2020" },
"it stops formatting out of calendar range" "it stops formatting out of calendar range"
) )
); );
@ -353,7 +353,7 @@ module("lib:local-date-builder", function () {
time: "18:00", time: "18:00",
localTimezone: LOS_ANGELES, localTimezone: LOS_ANGELES,
}, },
{ formated: "Tomorrow 11:00 AM" }, { formatted: "Tomorrow 11:00 AM" },
"it correctly displays a different local timezone" "it correctly displays a different local timezone"
); );
}); });
@ -367,7 +367,7 @@ module("lib:local-date-builder", function () {
previews: [ previews: [
{ {
current: true, current: true,
formated: formatted:
"Sunday, March 22, 2020 12:00 AM → Monday, March 23, 2020 12:00 AM", "Sunday, March 22, 2020 12:00 AM → Monday, March 23, 2020 12:00 AM",
timezone: "Paris", timezone: "Paris",
}, },
@ -383,12 +383,12 @@ module("lib:local-date-builder", function () {
previews: [ previews: [
{ {
current: true, current: true,
formated: formatted:
"Sunday, March 22, 2020 12:00 AM → Monday, March 23, 2020 12:00 AM", "Sunday, March 22, 2020 12:00 AM → Monday, March 23, 2020 12:00 AM",
timezone: "Paris", timezone: "Paris",
}, },
{ {
formated: formatted:
"Sunday, March 22, 2020 10:00 AM → Monday, March 23, 2020 10:00 AM", "Sunday, March 22, 2020 10:00 AM → Monday, March 23, 2020 10:00 AM",
timezone: "Sydney", timezone: "Sydney",
}, },
@ -404,7 +404,7 @@ module("lib:local-date-builder", function () {
previews: [ previews: [
{ {
current: true, current: true,
formated: formatted:
"Sunday, March 22, 2020 12:00 AM → Monday, March 23, 2020 12:00 AM", "Sunday, March 22, 2020 12:00 AM → Monday, March 23, 2020 12:00 AM",
timezone: "Paris", timezone: "Paris",
}, },
@ -420,7 +420,7 @@ module("lib:local-date-builder", function () {
previews: [ previews: [
{ {
current: true, current: true,
formated: formatted:
"Sunday, March 22, 2020 12:00 AM → Monday, March 23, 2020 12:00 AM", "Sunday, March 22, 2020 12:00 AM → Monday, March 23, 2020 12:00 AM",
timezone: "Paris", timezone: "Paris",
}, },
@ -436,7 +436,7 @@ module("lib:local-date-builder", function () {
previews: [ previews: [
{ {
current: true, current: true,
formated: formatted:
"Sunday, March 22, 2020 12:00 AM → Monday, March 23, 2020 12:00 AM", "Sunday, March 22, 2020 12:00 AM → Monday, March 23, 2020 12:00 AM",
timezone: "Paris", timezone: "Paris",
}, },
@ -452,7 +452,7 @@ module("lib:local-date-builder", function () {
previews: [ previews: [
{ {
current: true, current: true,
formated: formatted:
'Sunday, March 22, 2020 <br /><svg class=\'fa d-icon d-icon-clock svg-icon svg-string\' xmlns="http://www.w3.org/2000/svg"><use href="#clock" /></svg> 12:00 AM → 1:30 AM', 'Sunday, March 22, 2020 <br /><svg class=\'fa d-icon d-icon-clock svg-icon svg-string\' xmlns="http://www.w3.org/2000/svg"><use href="#clock" /></svg> 12:00 AM → 1:30 AM',
timezone: "Paris", timezone: "Paris",
}, },
@ -468,7 +468,7 @@ module("lib:local-date-builder", function () {
previews: [ previews: [
{ {
current: true, current: true,
formated: formatted:
"Sunday, March 22, 2020 12:00 AM → Monday, March 23, 2020 12:00 AM", "Sunday, March 22, 2020 12:00 AM → Monday, March 23, 2020 12:00 AM",
timezone: "Paris", timezone: "Paris",
}, },
@ -484,7 +484,7 @@ module("lib:local-date-builder", function () {
previews: [ previews: [
{ {
current: true, current: true,
formated: formatted:
'Sunday, March 22, 2020 <br /><svg class=\'fa d-icon d-icon-clock svg-icon svg-string\' xmlns="http://www.w3.org/2000/svg"><use href="#clock" /></svg> 11:34 AM', 'Sunday, March 22, 2020 <br /><svg class=\'fa d-icon d-icon-clock svg-icon svg-string\' xmlns="http://www.w3.org/2000/svg"><use href="#clock" /></svg> 11:34 AM',
timezone: "Paris", timezone: "Paris",
}, },
@ -504,22 +504,22 @@ module("lib:local-date-builder", function () {
previews: [ previews: [
{ {
current: true, current: true,
formated: formatted:
"Tuesday, April 7, 2020 12:00 AM → Wednesday, April 8, 2020 12:00 AM", "Tuesday, April 7, 2020 12:00 AM → Wednesday, April 8, 2020 12:00 AM",
timezone: "Paris", timezone: "Paris",
}, },
{ {
formated: formatted:
"Monday, April 6, 2020 11:00 PM → Tuesday, April 7, 2020 11:00 PM", "Monday, April 6, 2020 11:00 PM → Tuesday, April 7, 2020 11:00 PM",
timezone: "London", timezone: "London",
}, },
{ {
formated: formatted:
"Monday, April 6, 2020 11:00 PM → Tuesday, April 7, 2020 11:00 PM", "Monday, April 6, 2020 11:00 PM → Tuesday, April 7, 2020 11:00 PM",
timezone: "Lagos", timezone: "Lagos",
}, },
{ {
formated: formatted:
"Tuesday, April 7, 2020 8:00 AM → Wednesday, April 8, 2020 8:00 AM", "Tuesday, April 7, 2020 8:00 AM → Wednesday, April 8, 2020 8:00 AM",
timezone: "Sydney", timezone: "Sydney",
}, },
@ -540,22 +540,22 @@ module("lib:local-date-builder", function () {
previews: [ previews: [
{ {
current: true, current: true,
formated: formatted:
'Tuesday, April 7, 2020 <br /><svg class=\'fa d-icon d-icon-clock svg-icon svg-string\' xmlns="http://www.w3.org/2000/svg"><use href="#clock" /></svg> 2:54 PM', 'Tuesday, April 7, 2020 <br /><svg class=\'fa d-icon d-icon-clock svg-icon svg-string\' xmlns="http://www.w3.org/2000/svg"><use href="#clock" /></svg> 2:54 PM',
timezone: "Paris", timezone: "Paris",
}, },
{ {
formated: formatted:
'Tuesday, April 7, 2020 <br /><svg class=\'fa d-icon d-icon-clock svg-icon svg-string\' xmlns="http://www.w3.org/2000/svg"><use href="#clock" /></svg> 1:54 PM', 'Tuesday, April 7, 2020 <br /><svg class=\'fa d-icon d-icon-clock svg-icon svg-string\' xmlns="http://www.w3.org/2000/svg"><use href="#clock" /></svg> 1:54 PM',
timezone: "London", timezone: "London",
}, },
{ {
formated: formatted:
'Tuesday, April 7, 2020 <br /><svg class=\'fa d-icon d-icon-clock svg-icon svg-string\' xmlns="http://www.w3.org/2000/svg"><use href="#clock" /></svg> 1:54 PM', 'Tuesday, April 7, 2020 <br /><svg class=\'fa d-icon d-icon-clock svg-icon svg-string\' xmlns="http://www.w3.org/2000/svg"><use href="#clock" /></svg> 1:54 PM',
timezone: "Lagos", timezone: "Lagos",
}, },
{ {
formated: formatted:
'Tuesday, April 7, 2020 <br /><svg class=\'fa d-icon d-icon-clock svg-icon svg-string\' xmlns="http://www.w3.org/2000/svg"><use href="#clock" /></svg> 10:54 PM', 'Tuesday, April 7, 2020 <br /><svg class=\'fa d-icon d-icon-clock svg-icon svg-string\' xmlns="http://www.w3.org/2000/svg"><use href="#clock" /></svg> 10:54 PM',
timezone: "Sydney", timezone: "Sydney",
}, },
@ -575,12 +575,12 @@ module("lib:local-date-builder", function () {
previews: [ previews: [
{ {
current: true, current: true,
formated: formatted:
'Wednesday, May 13, 2020 <br /><svg class=\'fa d-icon d-icon-clock svg-icon svg-string\' xmlns="http://www.w3.org/2000/svg"><use href="#clock" /></svg> 11:00 AM', 'Wednesday, May 13, 2020 <br /><svg class=\'fa d-icon d-icon-clock svg-icon svg-string\' xmlns="http://www.w3.org/2000/svg"><use href="#clock" /></svg> 11:00 AM',
timezone: "Los Angeles", timezone: "Los Angeles",
}, },
{ {
formated: formatted:
'Wednesday, May 13, 2020 <br /><svg class=\'fa d-icon d-icon-clock svg-icon svg-string\' xmlns="http://www.w3.org/2000/svg"><use href="#clock" /></svg> 6:00 PM', 'Wednesday, May 13, 2020 <br /><svg class=\'fa d-icon d-icon-clock svg-icon svg-string\' xmlns="http://www.w3.org/2000/svg"><use href="#clock" /></svg> 6:00 PM',
timezone: "UTC", timezone: "UTC",
}, },