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