This commit is contained in:
@@ -38,8 +38,13 @@ function ayRegisterHelpers() {
|
|||||||
return utcDateToShortTimeLocalized(timestamp);
|
return utcDateToShortTimeLocalized(timestamp);
|
||||||
});
|
});
|
||||||
|
|
||||||
//ayDecimal
|
Handlebars.registerHelper("ayDecimal", function (value) {
|
||||||
//ayCurrency
|
return decimalLocalized(value);
|
||||||
|
});
|
||||||
|
|
||||||
|
Handlebars.registerHelper("ayCurrency", function (value) {
|
||||||
|
return currencyLocalized(value);
|
||||||
|
});
|
||||||
|
|
||||||
Handlebars.registerHelper("ayMarkdown", function (astring) {
|
Handlebars.registerHelper("ayMarkdown", function (astring) {
|
||||||
return marked(astring, { breaks: true });
|
return marked(astring, { breaks: true });
|
||||||
@@ -89,8 +94,8 @@ function utcDateToShortDateAndTimeLocalized(value) {
|
|||||||
return "not valid";
|
return "not valid";
|
||||||
}
|
}
|
||||||
|
|
||||||
return parsedDate.toLocaleString(AYMETA.ayClientMetaData.LanguageName, {
|
return parsedDate.toLocaleString(AYMETA.ayClientMetaData.LanguageName || "en-US", {
|
||||||
timeZone: AYMETA.ayClientMetaData.TimeZoneName,
|
timeZone: AYMETA.ayClientMetaData.TimeZoneName || "America/Winnipeg",
|
||||||
dateStyle: "short",
|
dateStyle: "short",
|
||||||
timeStyle: "short",
|
timeStyle: "short",
|
||||||
hour12: AYMETA.ayClientMetaData.Hour12
|
hour12: AYMETA.ayClientMetaData.Hour12
|
||||||
@@ -113,8 +118,8 @@ function utcDateToShortDateLocalized(value) {
|
|||||||
return "not valid";
|
return "not valid";
|
||||||
}
|
}
|
||||||
|
|
||||||
return parsedDate.toLocaleDateString(AYMETA.ayClientMetaData.LanguageName, {
|
return parsedDate.toLocaleDateString(AYMETA.ayClientMetaData.LanguageName || "en-US", {
|
||||||
timeZone: AYMETA.ayClientMetaData.TimeZoneName,
|
timeZone: AYMETA.ayClientMetaData.TimeZoneName || "America/Winnipeg",
|
||||||
dateStyle: "short"
|
dateStyle: "short"
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@@ -135,13 +140,40 @@ function utcDateToShortTimeLocalized(value) {
|
|||||||
return "not valid";
|
return "not valid";
|
||||||
}
|
}
|
||||||
|
|
||||||
return parsedDate.toLocaleTimeString(AYMETA.ayClientMetaData.LanguageName, {
|
return parsedDate.toLocaleTimeString(AYMETA.ayClientMetaData.LanguageName || "en-US", {
|
||||||
timeZone: AYMETA.ayClientMetaData.TimeZoneName,
|
timeZone: AYMETA.ayClientMetaData.TimeZoneName || "America/Winnipeg",
|
||||||
timeStyle: "short",
|
timeStyle: "short",
|
||||||
hour12: AYMETA.ayClientMetaData.Hour12
|
hour12: AYMETA.ayClientMetaData.Hour12
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
///////////////////////////////////////////
|
||||||
|
// CURRENCY LOCALIZATION
|
||||||
|
//
|
||||||
|
//
|
||||||
|
function currencyLocalized(value) {
|
||||||
|
if (!value) {
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
return new Intl.NumberFormat(
|
||||||
|
AYMETA.ayClientMetaData.LanguageName || "en-US",
|
||||||
|
{ style: 'currency', currency: AYMETA.ayClientMetaData.CurrencyName || "USD" }
|
||||||
|
).format(value)
|
||||||
|
}
|
||||||
|
|
||||||
|
///////////////////////////////////////////
|
||||||
|
// DECIMAL LOCALIZATION
|
||||||
|
//
|
||||||
|
//
|
||||||
|
function decimalLocalized(value) {
|
||||||
|
if (!value) {
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
return new Intl.NumberFormat(
|
||||||
|
AYMETA.ayClientMetaData.LanguageName || "en-US"
|
||||||
|
).format(value)
|
||||||
|
}
|
||||||
|
|
||||||
//////////////////////////////////
|
//////////////////////////////////
|
||||||
// cache to hold translations keys
|
// cache to hold translations keys
|
||||||
//
|
//
|
||||||
|
|||||||
Reference in New Issue
Block a user