@luftborn/custom-elements 2.8.3 → 2.8.4

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/demo/index.min.js CHANGED
@@ -2995,7 +2995,8 @@ var CustomDatepicker = /** @class */ (function () {
2995
2995
  this.lastDayOfMonth = new Date(this.currentYear, this.currentMonth + 1, 0);
2996
2996
  this.firstDay = this.firstDayOfMonth.getDay();
2997
2997
  this.lastDay = this.lastDayOfMonth.getDate();
2998
- this.months = (0, DatepickerTranslations_1.GetMonths)(options.language);
2998
+ this.language = options.language || 'en';
2999
+ this.months = (0, DatepickerTranslations_1.GetMonths)(this.language);
2999
3000
  this.daysOfWeek = (0, DatepickerTranslations_1.GetWeekdays)(options.language, 'short');
3000
3001
  this.createDatePickerElements();
3001
3002
  this.renderCalendar();
@@ -3082,7 +3083,8 @@ var CustomDatepicker = /** @class */ (function () {
3082
3083
  };
3083
3084
  CustomDatepicker.prototype.renderCalendar = function () {
3084
3085
  var _this = this;
3085
- this.monthYear.innerHTML = this.months[this.currentMonth] + ' ' + this.currentYear;
3086
+ var monthName = this.months[this.currentMonth];
3087
+ this.monthYear.innerHTML = monthName.charAt(0).toUpperCase() + monthName.slice(1) + ' ' + this.currentYear;
3086
3088
  this.weekdays.innerHTML = '';
3087
3089
  for (var i = 0; i < this.daysOfWeek.length; i++) {
3088
3090
  var span = document.createElement('span');
@@ -3133,7 +3135,7 @@ var CustomDatepicker = /** @class */ (function () {
3133
3135
  selectedDayElement.classList.remove('selected-day');
3134
3136
  }
3135
3137
  span.classList.add('selected-day');
3136
- var formattedDate = (0, CustomDatepickerUtils_1.formatDate)(_this.selectedDate, _this.dateFormat);
3138
+ var formattedDate = (0, CustomDatepickerUtils_1.formatDate)(_this.selectedDate, _this.dateFormat, _this.language);
3137
3139
  _this.input.value = formattedDate;
3138
3140
  _this.showPicker(false);
3139
3141
  };
@@ -3271,7 +3273,7 @@ var CustomDatepicker = /** @class */ (function () {
3271
3273
  }
3272
3274
  };
3273
3275
  CustomDatepicker.prototype.setDateForToday = function () {
3274
- this.input.value = (0, CustomDatepickerUtils_1.formatDate)(this.selectedDate, this.dateFormat);
3276
+ this.input.value = (0, CustomDatepickerUtils_1.formatDate)(this.selectedDate, this.dateFormat, this.language);
3275
3277
  this.showPicker(false);
3276
3278
  };
3277
3279
  CustomDatepicker.prototype.addEventListeners = function () {
@@ -3314,6 +3316,7 @@ exports.CustomDatepickerStyles = "\n .datepicker {\n position: fixed;\
3314
3316
  "use strict";
3315
3317
  Object.defineProperty(exports, "__esModule", { value: true });
3316
3318
  exports.isMobileDevice = exports.formatDate = exports.supportedDateFormats = exports.defaultDateFormat = exports.daysOfWeek = exports.months = void 0;
3319
+ var DatepickerTranslations_1 = require("./DatepickerTranslations");
3317
3320
  exports.months = ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December'];
3318
3321
  exports.daysOfWeek = ['Su', 'Mo', 'Tu', 'We', 'Th', 'Fr', 'Sa'];
3319
3322
  exports.defaultDateFormat = 'yyyy-mm-dd';
@@ -3330,11 +3333,13 @@ exports.supportedDateFormats = [
3330
3333
  'mm/dd/yy',
3331
3334
  'dd/mm/yy',
3332
3335
  ];
3333
- function formatDate(date, dateFormat) {
3336
+ function formatDate(date, dateFormat, language) {
3337
+ if (language === void 0) { language = 'en'; }
3334
3338
  var year = date.getFullYear();
3335
3339
  var month = (date.getMonth() + 1).toString().padStart(2, '0');
3336
3340
  var day = date.getDate().toString().padStart(2, '0');
3337
- var monthName = date.toLocaleString('default', { month: 'long' });
3341
+ var monthName = (0, DatepickerTranslations_1.GetMonths)(language)[date.getMonth()];
3342
+ var capitalizedMonthName = monthName.charAt(0).toUpperCase() + monthName.slice(1);
3338
3343
  var dateFormats = {
3339
3344
  'ddmmyyyy': "" + day + month + year,
3340
3345
  'mmddyyyy': "" + month + day + year,
@@ -3344,7 +3349,7 @@ function formatDate(date, dateFormat) {
3344
3349
  'mm-dd-yyyy': month + "-" + day + "-" + year,
3345
3350
  'yyyy-mm-dd': year + "-" + month + "-" + day,
3346
3351
  'yyyy-dd-mm': year + "-" + day + "-" + month,
3347
- 'Month dd, yyyy': monthName + " " + day + ", " + year,
3352
+ 'Month dd, yyyy': capitalizedMonthName + " " + day + ", " + year,
3348
3353
  'mm/dd/yy': month + "/" + day + "/" + year.toString().slice(-2),
3349
3354
  'dd/mm/yy': day + "/" + month + "/" + year.toString().slice(-2),
3350
3355
  };
@@ -3356,7 +3361,7 @@ function isMobileDevice() {
3356
3361
  }
3357
3362
  exports.isMobileDevice = isMobileDevice;
3358
3363
 
3359
- },{}],18:[function(require,module,exports){
3364
+ },{"./DatepickerTranslations":18}],18:[function(require,module,exports){
3360
3365
  "use strict";
3361
3366
  Object.defineProperty(exports, "__esModule", { value: true });
3362
3367
  exports.GetMonths = exports.GetWeekdays = void 0;