This repository has been archived by the owner on Oct 6, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor(jour): supprime les classes
- Loading branch information
Showing
8 changed files
with
68 additions
and
18 deletions.
There are no files selected for viewing
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
/** | ||
* Pour convertir une saisie en objet JavaScript | ||
* @memberof acte | ||
* @class | ||
* @chainable | ||
* @access public | ||
* @author Gilles Toubiana | ||
* @see {@link https://github.com/gtoubiana/acte|Projet sur GitHub} | ||
* @param {String} saisie - Saisie d'une date grégorienne ou républicaine. | ||
* @param {Boolean} [limites=true] - Par défaut, les résultats sont limités | ||
* aux périodes d'utilisation des calendriers :<br> | ||
* - une saisie de date grégorienne sera considérée comme julienne avant | ||
* le 15/10/1582<br> | ||
* - une saisie de date républicaine ne sera valide que du 22/9/1792 au | ||
* 31/12/1805 (Période républicaine) et du 18/3/1871 au 28/5/1871 | ||
* (Commune de Paris).<br> | ||
* La valeur `false` permet de désactiver ces limitations. | ||
* @since 0.0.7 | ||
* @license MIT | ||
*/ | ||
acte.Jour = function Jour(saisie, limites) { | ||
let tab = []; | ||
|
||
this.variables = this.variables || {}; | ||
this.limites = limites !== false; | ||
|
||
// On detecte si c'est une date républicaine | ||
if (saisie.match(/\W?an\s-?([-MDCLXVI]+|\d+)\W?/gi)) { | ||
tab = tabRepublicain(saisie, this.limites); | ||
|
||
// Si ce n'est pas du républicain (donc gregorien ou julien) | ||
} else { | ||
tab = tabGregorien(saisie, this.limites); | ||
} | ||
|
||
// Ecriture de toutes les valeurs | ||
this.variables = { | ||
gregorien: { | ||
jmc: tab[0], | ||
mc: tab[1], | ||
ac: tab[2], | ||
od: tab[3], | ||
}, | ||
julien: { | ||
jj: tab[4], | ||
jmc: tab[5], | ||
mc: tab[6], | ||
ac: tab[7], | ||
od: tab[8], | ||
}, | ||
republicain: { | ||
jdc: tab[9], | ||
dc: tab[10], | ||
jmc: tab[11], | ||
mc: tab[12], | ||
ac: tab[13], | ||
}, | ||
limites: this.limites, | ||
}; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters