diff --git a/Js/fonctions.js b/Js/fonctions.js index 2a8d9f8..1c8e067 100755 --- a/Js/fonctions.js +++ b/Js/fonctions.js @@ -1568,3 +1568,52 @@ function controle_date_avenant() $("#dateAvenant").readable(); $("#motifavenant").readable(); } + +$.prototype.enable = function () { + $.each(this, function (index, el) { + $(el).removeAttr('disabled'); + }); +} + +$.prototype.disable = function () { + $.each(this, function (index, el) { + $(el).attr('disabled', 'disabled'); + }); +} + +$.prototype.unreadable = function () { + $.each(this, function (index, el) { + $(el).attr('READONLY', 'READONLY'); + }); +} + +$.prototype.readable = function () { + $.each(this, function (index, el) { + $(el).removeAttr('READONLY'); + }); +} + +Date.estAnneeBissextile = function (annee) { + return (((annee % 4 === 0) && (annee % 100 !== 0)) || (annee % 400 === 0)); +}; + +Date.getDaysInMonth = function (annee, month) { + return [31, (Date.estAnneeBissextile(annee) ? 29 : 28), 31, 30, 31, 30, 31, 31, 30, 31, 30, 31][month]; +}; + +Date.prototype.estAnneeBissextile = function () { + return Date.estAnneeBissextile(this.getFullYear()); +}; + +Date.prototype.getDaysInMonth = function () { + return Date.getDaysInMonth(this.getFullYear(), this.getMonth()); +}; + +Date.prototype.addMonths = function (value) { + var n = this.getDate(); + this.setDate(1); + this.setMonth(this.getMonth() + value); + this.setDate(Math.min(n, this.getDaysInMonth())); + this.setDate(this.getDate()-1); + return this; +};