Skip to content
This repository has been archived by the owner on Oct 6, 2020. It is now read-only.

Commit

Permalink
fix: Correction du chevauchement Julien/Grégorien
Browse files Browse the repository at this point in the history
Pas de correspondances juliennes pour la période du 5 au 14/10/1582
  • Loading branch information
gtoubiana committed Oct 28, 2016
1 parent 618b5c8 commit cefb8fe
Show file tree
Hide file tree
Showing 8 changed files with 22 additions and 2 deletions.
Binary file modified dist/acte-0.0.17-dist.zip
Binary file not shown.
2 changes: 1 addition & 1 deletion dist/acte.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/acte.min.js.map

Large diffs are not rendered by default.

6 changes: 6 additions & 0 deletions src/js/private/functions/formatageDeJour.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ const formatageDeJour = (format, erreur, rappel, df, dt, dd, dobj, pro) => {
const tvg = dt;
let resultat;

// Correspondances uniquement entre les années -8000 et 8000
if (Math.abs(tvg[dd]) < 8000) {
resultat = frmt.replace(/%[ADJMNSabcflmoprvz123]+/g,

Expand All @@ -38,6 +39,11 @@ const formatageDeJour = (format, erreur, rappel, df, dt, dd, dobj, pro) => {
if (typeof rappel === 'function') {
resultat = rappel(resultat, dobj(tvg, pro));
}

// Pas de correspondances juliennes du 4 au 15/10/1582
if (pro === 'julien' && tvg.jj > 2299149.5 && tvg.jj < 2299160.5) {
resultat = err;
}
} else {
resultat = err;
}
Expand Down
2 changes: 2 additions & 0 deletions test/jasmine/acteSpec.js
Original file line number Diff line number Diff line change
Expand Up @@ -481,6 +481,8 @@ describe('new acte.Jour().julien()', function () {
expect(new acte.Jour('1/1/16000').julien('%A')).toEqual('Pas de correspondances.');
expect(new acte.Jour('1/1/-16000').julien('%A')).toEqual('Pas de correspondances.');
expect(new acte.Jour('1/1/16000', false).julien('%A')).toEqual('Pas de correspondances.');
expect(new acte.Jour('5/10/1582').julien('%A')).toEqual('Pas de correspondances.');
expect(new acte.Jour('14/10/1582').julien('%A')).toEqual('Pas de correspondances.');
});
it('new acte.Jour().julien(0, \'erreur\') = Message d\'erreur.', function () {
expect(new acte.Jour('').julien('', 'Message d\'erreur.')).toEqual('Message d\'erreur.');
Expand Down
6 changes: 6 additions & 0 deletions test/jasmine/lib/acte.js
Original file line number Diff line number Diff line change
Expand Up @@ -1911,6 +1911,7 @@ if (!Array.prototype.reduce) {
var tvg = dt;
var resultat = void 0;

// Correspondances uniquement entre les années -8000 et 8000
if (Math.abs(tvg[dd]) < 8000) {
resultat = frmt.replace(/%[ADJMNSabcflmoprvz123]+/g,

Expand All @@ -1924,6 +1925,11 @@ if (!Array.prototype.reduce) {
if (typeof rappel === 'function') {
resultat = rappel(resultat, dobj(tvg, pro));
}

// Pas de correspondances juliennes du 4 au 15/10/1582
if (pro === 'julien' && tvg.jj > 2299149.5 && tvg.jj < 2299160.5) {
resultat = err;
}
} else {
resultat = err;
}
Expand Down
2 changes: 2 additions & 0 deletions test/jasmine/lib/acteSpec.js
Original file line number Diff line number Diff line change
Expand Up @@ -480,6 +480,8 @@ describe('new acte.Jour().julien()', function () {
expect(new acte.Jour('1/1/16000').julien('%A')).toEqual('Pas de correspondances.');
expect(new acte.Jour('1/1/-16000').julien('%A')).toEqual('Pas de correspondances.');
expect(new acte.Jour('1/1/16000', false).julien('%A')).toEqual('Pas de correspondances.');
expect(new acte.Jour('5/10/1582').julien('%A')).toEqual('Pas de correspondances.');
expect(new acte.Jour('14/10/1582').julien('%A')).toEqual('Pas de correspondances.');
});
it('new acte.Jour().julien(0, \'erreur\') = Message d\'erreur.', function () {
expect(new acte.Jour('').julien('', 'Message d\'erreur.')).toEqual('Message d\'erreur.');
Expand Down
4 changes: 4 additions & 0 deletions test/spec-JourJulien.js
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,10 @@ describe('new acte.Jour().julien()', () => {
.toEqual('Pas de correspondances.');
expect(new acte.Jour('1/1/16000', false).julien('%A'))
.toEqual('Pas de correspondances.');
expect(new acte.Jour('5/10/1582').julien('%A'))
.toEqual('Pas de correspondances.');
expect(new acte.Jour('14/10/1582').julien('%A'))
.toEqual('Pas de correspondances.');
});
it(
'new acte.Jour().julien(0, \'erreur\') = Message d\'erreur.',
Expand Down

0 comments on commit cefb8fe

Please sign in to comment.