const asArray = x => Array.isArray(x) ? x : [ x ]
Month: May 2022
[SAPUI5] Get i18n texts
To simply get access to i18n texts, I useally add this helper function to my BaseController.js
// helper for direct access to the ResourceBundle getText() function
getText : function (sTextKey, aParamter) {
return this.getOwnerComponent().getModel("i18n").getResourceBundle().getText(sTextKey, aParamter)
}
Texts can then be read in every controller with
// i18n: objects=Amount of objects: {0}
this.getText("objects", [iLength])
[JavaScript] Get the Start and End of the Day in format yyyy-MM-ddTHH:mm:ss.SSSZ
const start = new Date()
const end = new Date()
start.setHours(0, 0, 0, 0)
end.setHours(23, 59, 59, 999)
console.log(start.toISOString())
console.log(end.toISOString())