@wistia/ui 0.13.13-beta.973c692d.475fb3e → 0.13.13
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.
- package/dist/index.cjs +20 -19
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.mts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.mjs +20 -19
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
|
|
2
2
|
/*
|
|
3
|
-
* @license @wistia/ui v0.13.13
|
|
3
|
+
* @license @wistia/ui v0.13.13
|
|
4
4
|
*
|
|
5
5
|
* Copyright (c) 2024-2025, Wistia, Inc. and its affiliates.
|
|
6
6
|
*
|
|
@@ -1676,7 +1676,6 @@ var minutesInHour = 60;
|
|
|
1676
1676
|
var halfAnHourInMinutes = 30;
|
|
1677
1677
|
var hoursInDay = 24;
|
|
1678
1678
|
var milisecondsInSecond = 1e3;
|
|
1679
|
-
var daysInWeek = 7;
|
|
1680
1679
|
var millisecondsInDay = hoursInDay * minutesInHour * secondsInMinute * milisecondsInSecond;
|
|
1681
1680
|
|
|
1682
1681
|
// src/helpers/dateTime/buildTimeDuration.ts
|
|
@@ -1820,7 +1819,7 @@ var dateTimeRounded = (dateTime2, toISOString = true) => {
|
|
|
1820
1819
|
|
|
1821
1820
|
// src/helpers/dateTime/dateTimeString.ts
|
|
1822
1821
|
var import_type_guards3 = require("@wistia/type-guards");
|
|
1823
|
-
var dateTimeString = (date, { timeZone = defaultTimeZone
|
|
1822
|
+
var dateTimeString = (date, { timeZone = defaultTimeZone } = {}) => {
|
|
1824
1823
|
if ((0, import_type_guards3.isNil)(date)) {
|
|
1825
1824
|
return "";
|
|
1826
1825
|
}
|
|
@@ -1829,15 +1828,11 @@ var dateTimeString = (date, { timeZone = defaultTimeZone, omitYear = false } = {
|
|
|
1829
1828
|
return "";
|
|
1830
1829
|
}
|
|
1831
1830
|
try {
|
|
1832
|
-
|
|
1833
|
-
|
|
1834
|
-
|
|
1835
|
-
hour: "numeric",
|
|
1836
|
-
minute: "2-digit",
|
|
1831
|
+
return new Intl.DateTimeFormat(defaultLocales, {
|
|
1832
|
+
dateStyle: "medium",
|
|
1833
|
+
timeStyle: "short",
|
|
1837
1834
|
timeZone
|
|
1838
|
-
};
|
|
1839
|
-
const options = omitYear ? baseOptions : { ...baseOptions, year: "numeric" };
|
|
1840
|
-
return formattedDate.toLocaleDateString(defaultLocales, options);
|
|
1835
|
+
}).format(formattedDate);
|
|
1841
1836
|
} catch (error) {
|
|
1842
1837
|
console.error(error);
|
|
1843
1838
|
return "";
|
|
@@ -1988,12 +1983,13 @@ var differenceInCalendarDays = (dateLeft, dateRight) => {
|
|
|
1988
1983
|
};
|
|
1989
1984
|
|
|
1990
1985
|
// src/helpers/dateTime/timeAgoString.ts
|
|
1991
|
-
var timeAgoString = (date, { nowAnchor = /* @__PURE__ */ new Date()
|
|
1992
|
-
if (isInvalidDate(date))
|
|
1986
|
+
var timeAgoString = (date, { nowAnchor = /* @__PURE__ */ new Date() } = {}) => {
|
|
1987
|
+
if (isInvalidDate(date)) {
|
|
1988
|
+
return "";
|
|
1989
|
+
}
|
|
1993
1990
|
const minutesAgo = (nowAnchor.valueOf() - date.valueOf()) / (secondsInMinute * milisecondsInSecond);
|
|
1994
1991
|
const minutesAgoRounded = Math.round(minutesAgo);
|
|
1995
1992
|
const differenceInDays = differenceInCalendarDays(nowAnchor, date);
|
|
1996
|
-
const isSameYear = date.getFullYear() === nowAnchor.getFullYear();
|
|
1997
1993
|
if (minutesAgo < 0) {
|
|
1998
1994
|
return dateTimeString(date);
|
|
1999
1995
|
}
|
|
@@ -2007,15 +2003,20 @@ var timeAgoString = (date, { nowAnchor = /* @__PURE__ */ new Date(), includeTime
|
|
|
2007
2003
|
return `${minutesAgoRounded} minutes ago`;
|
|
2008
2004
|
}
|
|
2009
2005
|
if (differenceInDays === 0) {
|
|
2010
|
-
return
|
|
2006
|
+
return `Today, ${Intl.DateTimeFormat(defaultLocales, { timeStyle: "short" }).format(date)}`;
|
|
2011
2007
|
}
|
|
2012
2008
|
if (differenceInDays === 1) {
|
|
2013
|
-
return
|
|
2009
|
+
return `Yesterday, ${Intl.DateTimeFormat(defaultLocales, { timeStyle: "short" }).format(date)}`;
|
|
2014
2010
|
}
|
|
2015
|
-
if (
|
|
2016
|
-
return
|
|
2011
|
+
if (date.getFullYear() === nowAnchor.getFullYear()) {
|
|
2012
|
+
return Intl.DateTimeFormat(defaultLocales, {
|
|
2013
|
+
day: "numeric",
|
|
2014
|
+
month: "short",
|
|
2015
|
+
hour: "numeric",
|
|
2016
|
+
minute: "2-digit"
|
|
2017
|
+
}).format(date);
|
|
2017
2018
|
}
|
|
2018
|
-
return
|
|
2019
|
+
return dateTimeString(date);
|
|
2019
2020
|
};
|
|
2020
2021
|
|
|
2021
2022
|
// src/helpers/dateTime/timeOnlyString.ts
|