From 9d848c84648f0dff5c06d9fb35bc8e006c9db458 Mon Sep 17 00:00:00 2001 From: Mojtaba Samimi Date: Thu, 3 Jul 2025 18:56:22 -0400 Subject: [PATCH 1/5] intsall fix for Persian calendar --- package-lock.json | 7 ++++--- package.json | 8 ++++---- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/package-lock.json b/package-lock.json index 8d55afe7f2f..8bd656db112 100644 --- a/package-lock.json +++ b/package-lock.json @@ -58,7 +58,7 @@ "to-px": "1.0.1", "topojson-client": "^3.1.0", "webgl-context": "^2.2.0", - "world-calendars": "^1.0.3" + "world-calendars": "github:archmoj/world-calendars#0faeec8544d289c94845a73fcbb813b9bb423599" }, "devDependencies": { "@biomejs/biome": "1.8.3", @@ -10905,8 +10905,9 @@ }, "node_modules/world-calendars": { "version": "1.0.3", - "resolved": "https://registry.npmjs.org/world-calendars/-/world-calendars-1.0.3.tgz", - "integrity": "sha1-slxQMrokEo/8QdCfr0pewbnBQzU=", + "resolved": "git+ssh://git@github.com/archmoj/world-calendars.git#0faeec8544d289c94845a73fcbb813b9bb423599", + "integrity": "sha512-fzQ4K3LOfHT8RBu1dj608UTIrorwDXXhJLqArqdZstHyurcOipgI2/EkJYO27jDDNUe0vRB1f30+rH1ew0farw==", + "license": "MIT", "dependencies": { "object-assign": "^4.1.0" } diff --git a/package.json b/package.json index 39f76f1a5dd..2aebf0b9226 100644 --- a/package.json +++ b/package.json @@ -72,6 +72,7 @@ "@plotly/d3-sankey": "0.7.2", "@plotly/d3-sankey-circular": "0.33.1", "@plotly/mapbox-gl": "1.13.4", + "@plotly/regl": "^2.1.2", "@turf/area": "^7.1.0", "@turf/bbox": "^7.1.0", "@turf/centroid": "^7.1.0", @@ -105,7 +106,6 @@ "point-in-polygon": "^1.1.0", "polybooljs": "^1.2.2", "probe-image-size": "^7.2.3", - "@plotly/regl": "^2.1.2", "regl-error2d": "^2.0.12", "regl-line2d": "^3.1.3", "regl-scatter2d": "^3.3.1", @@ -117,10 +117,12 @@ "to-px": "1.0.1", "topojson-client": "^3.1.0", "webgl-context": "^2.2.0", - "world-calendars": "^1.0.3" + "world-calendars": "github:archmoj/world-calendars#0faeec8544d289c94845a73fcbb813b9bb423599" }, "devDependencies": { "@biomejs/biome": "1.8.3", + "@plotly/mathjax-v2": "npm:mathjax@2.7.5", + "@plotly/mathjax-v3": "npm:mathjax@^3.2.2", "amdefine": "^1.0.1", "assert": "^2.1.0", "browserify-transform-tools": "^1.7.0", @@ -160,8 +162,6 @@ "karma-viewport": "1.0.2", "lodash": "^4.17.21", "madge": "^8.0.0", - "@plotly/mathjax-v2": "npm:mathjax@2.7.5", - "@plotly/mathjax-v3": "npm:mathjax@^3.2.2", "minify-stream": "^2.1.0", "npm-link-check": "^5.0.1", "open": "^8.4.2", From 5aa7232c5e8a71a4e376846d52a7a2aa97fd92d6 Mon Sep 17 00:00:00 2001 From: Mojtaba Samimi Date: Thu, 3 Jul 2025 21:37:53 -0400 Subject: [PATCH 2/5] add jasmine tests --- test/jasmine/tests/lib_date_test.js | 58 +++++++++++++++++++++++++++++ 1 file changed, 58 insertions(+) diff --git a/test/jasmine/tests/lib_date_test.js b/test/jasmine/tests/lib_date_test.js index 55d6aa7b16c..186afd033a2 100644 --- a/test/jasmine/tests/lib_date_test.js +++ b/test/jasmine/tests/lib_date_test.js @@ -368,6 +368,64 @@ describe('dates', function() { expect(Lib.dateTime2ms(v, 'chinese')).toBeUndefined(v); }); }); + + it('Persian calendar should convert right values', function() { + var leapYears = [ + 479, 483, 487, 491, 495, 499, + 503, 508, 512, 516, 520, 524, 528, 532, 536, 541, 545, 549, 553, 557, 561, 565, 569, 574, 578, 582, 586, 590, 594, 598, + 602, 607, 611, 615, 619, 623, 627, 631, 636, 640, 644, 648, 652, 656, 660, 664, 669, 673, 677, 681, 685, 689, 693, 697, + 702, 706, 710, 714, 718, 722, 726, 730, 735, 739, 743, 747, 751, 755, 759, 764, 768, 772, 776, 780, 784, 788, 792, 797, + 801, 805, 809, 813, 817, 821, 825, 830, 834, 838, 842, 846, 850, 854, 858, 863, 867, 871, 875, 879, 883, 887, 892, 896, + 900, 904, 908, 912, 916, 920, 925, 929, 933, 937, 941, 945, 949, 953, 958, 962, 966, 970, 974, 978, 982, 986, 991, 995, 999, + 1003, 1007, 1011, 1015, 1020, 1024, 1028, 1032, 1036, 1040, 1044, 1048, 1053, 1057, 1061, 1065, 1069, 1073, 1077, 1081, 1086, 1090, 1094, 1098, + 1102, 1106, 1110, 1114, 1119, 1123, 1127, 1131, 1135, 1139, 1143, 1148, 1152, 1156, 1160, 1164, 1168, 1172, 1176, 1181, 1185, 1189, 1193, 1197, + 1201, 1205, 1209, 1214, 1218, 1222, 1226, 1230, 1234, 1238, 1242, 1247, 1251, 1255, 1259, 1263, 1267, 1271, 1276, 1280, 1284, 1288, 1292, 1296, + 1300, 1304, 1309, 1313, 1317, 1321, 1325, 1329, 1333, 1337, 1342, 1346, 1350, 1354, 1358, 1362, 1366, 1370, 1375, 1379, 1383, 1387, 1391, 1395, 1399, + 1403, 1408, 1412, 1416, 1420, 1424, 1428, 1432, 1437, 1441, 1445, 1449, 1453, 1457, 1461, 1465, 1470, 1474, 1478, 1482, 1486, 1490, 1494, 1498, + 1503, 1507, 1511, 1515, 1519, 1523 + ]; + + var dates = []; + + for(var y = 475; y < 1525; y++) { + if(y === 0) continue; + for(var m = 1; m <= 12; m++) { + for(var d = 1; d <= (m < 7 ? 31 : 30); d++) { + if(d === 30 && m === 12 && leapYears.indexOf(y) === -1) continue; + + dates.push([ + (y < 1000 ? '0' : '') + y, + (m < 10 ? '0' : '') + m, + (d < 10 ? '0' : '') + d + ].join('-')); + } + } + } + + var unixIndex = dates.indexOf('1348-10-11'); + + var tests = []; + for(var i = 0; i < dates.length; i++) { + var date = dates[i]; + var parts = date.split('-'); + var d = +parts[2]; + + // only test days at the start/end of months + if(d < 3 || d > 28) { + var time = (i - unixIndex) * 86400000; + + tests.push([date, time]); + } + } + + tests.forEach(function(v) { + var calendar = 'persian'; + var dateStr = v[0]; + var ms = v[1]; + expect(Lib.ms2DateTime(ms, 0, calendar)).toBe(dateStr); + expect(Lib.dateTime2ms(dateStr, calendar)).toBe(ms); + }); + }); }); describe('cleanDate', function() { From 36f0a830141b80face45110292f5290627a1c211 Mon Sep 17 00:00:00 2001 From: Mojtaba Samimi Date: Mon, 7 Jul 2025 11:59:49 -0400 Subject: [PATCH 3/5] draft log --- draftlogs/7456_fix.md | 1 + 1 file changed, 1 insertion(+) create mode 100644 draftlogs/7456_fix.md diff --git a/draftlogs/7456_fix.md b/draftlogs/7456_fix.md new file mode 100644 index 00000000000..587a23d9995 --- /dev/null +++ b/draftlogs/7456_fix.md @@ -0,0 +1 @@ + - Fix Persian calendar leap year [[#7456](https://github.com/plotly/plotly.js/pull/7456)] From f5709a2d0b739d3402366633c4fbf58969c77c69 Mon Sep 17 00:00:00 2001 From: Mojtaba Samimi Date: Fri, 11 Jul 2025 11:06:29 -0400 Subject: [PATCH 4/5] repository transferred to plotly/world-calendars --- package-lock.json | 4 ++-- package.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/package-lock.json b/package-lock.json index ed644ff0e06..862a88fd813 100644 --- a/package-lock.json +++ b/package-lock.json @@ -58,7 +58,7 @@ "to-px": "1.0.1", "topojson-client": "^3.1.0", "webgl-context": "^2.2.0", - "world-calendars": "github:archmoj/world-calendars#0faeec8544d289c94845a73fcbb813b9bb423599" + "world-calendars": "github:plotly/world-calendars#c82a7815f39d2c7de27e6fee59d7d4537d18304d" }, "devDependencies": { "@biomejs/biome": "1.8.3", @@ -10909,7 +10909,7 @@ }, "node_modules/world-calendars": { "version": "1.0.3", - "resolved": "git+ssh://git@github.com/archmoj/world-calendars.git#0faeec8544d289c94845a73fcbb813b9bb423599", + "resolved": "git+ssh://git@github.com/plotly/world-calendars.git#c82a7815f39d2c7de27e6fee59d7d4537d18304d", "integrity": "sha512-fzQ4K3LOfHT8RBu1dj608UTIrorwDXXhJLqArqdZstHyurcOipgI2/EkJYO27jDDNUe0vRB1f30+rH1ew0farw==", "license": "MIT", "dependencies": { diff --git a/package.json b/package.json index 2aebf0b9226..46f5a98f340 100644 --- a/package.json +++ b/package.json @@ -117,7 +117,7 @@ "to-px": "1.0.1", "topojson-client": "^3.1.0", "webgl-context": "^2.2.0", - "world-calendars": "github:archmoj/world-calendars#0faeec8544d289c94845a73fcbb813b9bb423599" + "world-calendars": "github:plotly/world-calendars#c82a7815f39d2c7de27e6fee59d7d4537d18304d" }, "devDependencies": { "@biomejs/biome": "1.8.3", From 83ba2c547334de4effa2a6ba37c1260d699b1558 Mon Sep 17 00:00:00 2001 From: Mojtaba Samimi Date: Fri, 11 Jul 2025 12:32:34 -0400 Subject: [PATCH 5/5] install world-calendars 1.0.4 --- package-lock.json | 8 ++++---- package.json | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/package-lock.json b/package-lock.json index 862a88fd813..312e3626c14 100644 --- a/package-lock.json +++ b/package-lock.json @@ -58,7 +58,7 @@ "to-px": "1.0.1", "topojson-client": "^3.1.0", "webgl-context": "^2.2.0", - "world-calendars": "github:plotly/world-calendars#c82a7815f39d2c7de27e6fee59d7d4537d18304d" + "world-calendars": "^1.0.4" }, "devDependencies": { "@biomejs/biome": "1.8.3", @@ -10908,9 +10908,9 @@ } }, "node_modules/world-calendars": { - "version": "1.0.3", - "resolved": "git+ssh://git@github.com/plotly/world-calendars.git#c82a7815f39d2c7de27e6fee59d7d4537d18304d", - "integrity": "sha512-fzQ4K3LOfHT8RBu1dj608UTIrorwDXXhJLqArqdZstHyurcOipgI2/EkJYO27jDDNUe0vRB1f30+rH1ew0farw==", + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/world-calendars/-/world-calendars-1.0.4.tgz", + "integrity": "sha512-VGRnLJS+xJmGDPodgJRnGIDwGu0s+Cr9V2HB3EzlDZ5n0qb8h5SJtGUEkjrphZYAglEiXZ6kiXdmk0H/h/uu/w==", "license": "MIT", "dependencies": { "object-assign": "^4.1.0" diff --git a/package.json b/package.json index 46f5a98f340..4ec25c55d5d 100644 --- a/package.json +++ b/package.json @@ -117,7 +117,7 @@ "to-px": "1.0.1", "topojson-client": "^3.1.0", "webgl-context": "^2.2.0", - "world-calendars": "github:plotly/world-calendars#c82a7815f39d2c7de27e6fee59d7d4537d18304d" + "world-calendars": "^1.0.4" }, "devDependencies": { "@biomejs/biome": "1.8.3", pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy