b374k
m1n1 1.01
Apache/2.4.41 (Ubuntu)
Linux vmi616275.contaboserver.net 5.4.0-84-generic #94-Ubuntu SMP Thu Aug 26 20:27:37 UTC 2021 x86_64
uid=33(www-data) gid=33(www-data) groups=33(www-data)
server ip : 62.171.164.128 | your ip : 127.0.0.1
safemode OFF
 >  / home / dev2.destoffenstraat.com / app / code / Swissup / DeliveryDate / view / frontend / web / js /
Filename/home/dev2.destoffenstraat.com/app/code/Swissup/DeliveryDate/view/frontend/web/js/delivery-date.js
Size2.18 kb
Permissionrwxrwxrwx
Ownerroot : root
Create time17-Aug-2025 10:26
Last modified03-May-2022 16:07
Last accessed24-Aug-2025 02:07
Actionsedit | rename | delete | download (gzip)
Viewtext | code | image
define([
'underscore',
'Magento_Ui/js/form/element/abstract'
], function (_, Element) {
'use strict';

return Element.extend({
defaults: {
template: 'ui/form/field',
elementTmpl: 'ui/form/element/date',
validationParams: {
dateFormat: '${ $.options.dateFormat }'
},
holidays: [],
excludedWeekdays: []
},

/**
* Initializes regular properties of instance.
*
* @return {Element}
*/
initConfig: function () {
var self = this,
momentFormat;

this._super();

// convert calendar format to moment.js format. (utils method is not sufficient)
momentFormat = this.validationParams.dateFormat;
momentFormat = momentFormat.replace('dd', 'DD'); // 01 to 31
momentFormat = momentFormat.replace('d', 'D'); // 1 to 31
momentFormat = momentFormat.replace('mm', 'MM'); // ui2moment
momentFormat = momentFormat.replace('EEEE', 'dddd'); // Sunday through Saturday
momentFormat = momentFormat.replace('EEE', 'ddd'); // Sun through Sat
momentFormat = momentFormat.replace('o', 'DDDD'); // 1 to 365
this.validationParams.dateFormat = momentFormat;

/**
* @param {Date} date
* @return {Array}
*/
this.options.beforeShowDay = function (date) {
return [!self.isExcludedWeekday(date) && !self.isHoliday(date), ''];
};

return this;
},

/**
* @param {Date} date
* @return {Boolean}
*/
isExcludedWeekday: function (date) {
return this.excludedWeekdays.indexOf(date.getDay()) !== -1;
},

/**
* @param {Date} date
* @return {Boolean}
*/
isHoliday: function (date) {
date = date.setHours(0, 0, 0, 0);

return _.some(this.holidays, function (holiday) {
return date === (new Date(holiday)).setHours(0, 0, 0, 0);
});
}
});
});