@trackunit/date-and-time-utils 0.0.35 → 0.0.36
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/index.cjs.js +2 -2
- package/index.esm.js +2 -2
- package/package.json +1 -1
package/index.cjs.js
CHANGED
|
@@ -974,7 +974,7 @@ const timeSinceInDays = (from, to, timeZone, locale) => {
|
|
|
974
974
|
let since = new polyfill.Temporal.Duration();
|
|
975
975
|
try {
|
|
976
976
|
since = toZonedDateTimeUtil(from, timeZone).since(toZonedDateTimeUtil(to, timeZone), {
|
|
977
|
-
largestUnit: "
|
|
977
|
+
largestUnit: "hour",
|
|
978
978
|
});
|
|
979
979
|
}
|
|
980
980
|
catch (error) {
|
|
@@ -982,7 +982,7 @@ const timeSinceInDays = (from, to, timeZone, locale) => {
|
|
|
982
982
|
console.warn("Error: ", error);
|
|
983
983
|
}
|
|
984
984
|
const duration = polyfill.Temporal.Duration.from(since);
|
|
985
|
-
return getRelativeTimeFormat(locale).format(duration.
|
|
985
|
+
return getRelativeTimeFormat(locale).format(Math.ceil(duration.hours / 24.0), "days");
|
|
986
986
|
};
|
|
987
987
|
/**
|
|
988
988
|
* Calculates the time duration between two TemporalDate objects and returns the duration in months as a formatted string.
|
package/index.esm.js
CHANGED
|
@@ -970,7 +970,7 @@ const timeSinceInDays = (from, to, timeZone, locale) => {
|
|
|
970
970
|
let since = new Temporal.Duration();
|
|
971
971
|
try {
|
|
972
972
|
since = toZonedDateTimeUtil(from, timeZone).since(toZonedDateTimeUtil(to, timeZone), {
|
|
973
|
-
largestUnit: "
|
|
973
|
+
largestUnit: "hour",
|
|
974
974
|
});
|
|
975
975
|
}
|
|
976
976
|
catch (error) {
|
|
@@ -978,7 +978,7 @@ const timeSinceInDays = (from, to, timeZone, locale) => {
|
|
|
978
978
|
console.warn("Error: ", error);
|
|
979
979
|
}
|
|
980
980
|
const duration = Temporal.Duration.from(since);
|
|
981
|
-
return getRelativeTimeFormat(locale).format(duration.
|
|
981
|
+
return getRelativeTimeFormat(locale).format(Math.ceil(duration.hours / 24.0), "days");
|
|
982
982
|
};
|
|
983
983
|
/**
|
|
984
984
|
* Calculates the time duration between two TemporalDate objects and returns the duration in months as a formatted string.
|