Removing console log and approx sign

This commit is contained in:
Vivek Pandey 2024-10-19 19:24:41 +05:30
parent 2438e87efa
commit b000c1d532

View file

@ -235,15 +235,10 @@ class RelativeTimeFormatter {
/** /**
* Method to update the instance locale and options * Method to update the instance locale and options
* @param {string} locale Localization identifier (e.g., "en", "ar-sy") to update the instance with. * @param {string} locale Localization identifier (e.g., "en", "ar-sy") to update the instance with.
* @param {object} options Instance options to be passed.
* @returns {void} No return value. * @returns {void} No return value.
*/ */
updateLocale(locale, options = {}) { updateLocale(locale) {
this.locale = locale; this.locale = locale;
this.options = {
...this.options,
...options,
};
this.rtf = new Intl.RelativeTimeFormat(this.locale, this.options); this.rtf = new Intl.RelativeTimeFormat(this.locale, this.options);
} }
@ -266,7 +261,6 @@ class RelativeTimeFormatter {
*/ */
const toFormattedPart = (value, unitOfTime) => { const toFormattedPart = (value, unitOfTime) => {
const res = this.getInstance().formatToParts(value, unitOfTime); const res = this.getInstance().formatToParts(value, unitOfTime);
console.log(res);
let formattedString = res let formattedString = res
.map((part, _idx) => { .map((part, _idx) => {
if ( if (
@ -297,7 +291,7 @@ class RelativeTimeFormatter {
const result = const result =
parts.length > 0 parts.length > 0
? `~ ${parts.join(" ")}` ? `${parts.join(" ")}`
: this.getInstance().format(0, "second"); // Handle case for 0 seconds : this.getInstance().format(0, "second"); // Handle case for 0 seconds
return result; return result;