This commit is contained in:
@@ -38,8 +38,13 @@ function ayRegisterHelpers() {
|
||||
return utcDateToShortTimeLocalized(timestamp);
|
||||
});
|
||||
|
||||
//ayDecimal
|
||||
//ayCurrency
|
||||
Handlebars.registerHelper("ayDecimal", function (value) {
|
||||
return decimalLocalized(value);
|
||||
});
|
||||
|
||||
Handlebars.registerHelper("ayCurrency", function (value) {
|
||||
return currencyLocalized(value);
|
||||
});
|
||||
|
||||
Handlebars.registerHelper("ayMarkdown", function (astring) {
|
||||
return marked(astring, { breaks: true });
|
||||
@@ -89,8 +94,8 @@ function utcDateToShortDateAndTimeLocalized(value) {
|
||||
return "not valid";
|
||||
}
|
||||
|
||||
return parsedDate.toLocaleString(AYMETA.ayClientMetaData.LanguageName, {
|
||||
timeZone: AYMETA.ayClientMetaData.TimeZoneName,
|
||||
return parsedDate.toLocaleString(AYMETA.ayClientMetaData.LanguageName || "en-US", {
|
||||
timeZone: AYMETA.ayClientMetaData.TimeZoneName || "America/Winnipeg",
|
||||
dateStyle: "short",
|
||||
timeStyle: "short",
|
||||
hour12: AYMETA.ayClientMetaData.Hour12
|
||||
@@ -113,8 +118,8 @@ function utcDateToShortDateLocalized(value) {
|
||||
return "not valid";
|
||||
}
|
||||
|
||||
return parsedDate.toLocaleDateString(AYMETA.ayClientMetaData.LanguageName, {
|
||||
timeZone: AYMETA.ayClientMetaData.TimeZoneName,
|
||||
return parsedDate.toLocaleDateString(AYMETA.ayClientMetaData.LanguageName || "en-US", {
|
||||
timeZone: AYMETA.ayClientMetaData.TimeZoneName || "America/Winnipeg",
|
||||
dateStyle: "short"
|
||||
});
|
||||
}
|
||||
@@ -135,13 +140,40 @@ function utcDateToShortTimeLocalized(value) {
|
||||
return "not valid";
|
||||
}
|
||||
|
||||
return parsedDate.toLocaleTimeString(AYMETA.ayClientMetaData.LanguageName, {
|
||||
timeZone: AYMETA.ayClientMetaData.TimeZoneName,
|
||||
return parsedDate.toLocaleTimeString(AYMETA.ayClientMetaData.LanguageName || "en-US", {
|
||||
timeZone: AYMETA.ayClientMetaData.TimeZoneName || "America/Winnipeg",
|
||||
timeStyle: "short",
|
||||
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
|
||||
//
|
||||
|
||||
Reference in New Issue
Block a user