@d3plus/core 3.0.0 → 3.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -13,7 +13,7 @@ import modules from "@d3plus/core";
13
13
  In vanilla JavaScript, a `d3plus` global is exported from the pre-bundled version:
14
14
 
15
15
  ```html
16
- <script src="https://cdn.jsdelivr.net/npm/@d3plus/core@3.0.0"></script>
16
+ <script src="https://cdn.jsdelivr.net/npm/@d3plus/core"></script>
17
17
  <script>
18
18
  console.log(d3plus);
19
19
  </script>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@d3plus/core",
3
- "version": "3.0.0",
3
+ "version": "3.0.1",
4
4
  "description": "Data visualization made easy. A javascript library that extends the popular D3.js to enable fast and beautiful visualizations.",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -34,13 +34,13 @@
34
34
  "test": "eslint index.js src/**/*.js && eslint --global=it test && mocha 'test/**/*-test.js'"
35
35
  },
36
36
  "dependencies": {
37
- "@d3plus/color": "3.0.0",
38
- "@d3plus/data": "3.0.0",
39
- "@d3plus/dom": "3.0.0",
40
- "@d3plus/format": "3.0.0",
41
- "@d3plus/locales": "3.0.0",
42
- "@d3plus/math": "3.0.0",
43
- "@d3plus/text": "3.0.0",
37
+ "@d3plus/color": "3.0.1",
38
+ "@d3plus/data": "3.0.1",
39
+ "@d3plus/dom": "3.0.1",
40
+ "@d3plus/format": "3.0.1",
41
+ "@d3plus/locales": "3.0.1",
42
+ "@d3plus/math": "3.0.1",
43
+ "@d3plus/text": "3.0.1",
44
44
  "@popperjs/core": "^2.11.8",
45
45
  "d3-array": "^3.2.4",
46
46
  "d3-brush": "^3.0.0",
@@ -1,5 +1,5 @@
1
1
  /*
2
- @d3plus/core v3.0.0
2
+ @d3plus/core v3.0.1
3
3
  Data visualization made easy. A javascript library that extends the popular D3.js to enable fast and beautiful visualizations.
4
4
  Copyright (c) 2025 D3plus - https://d3plus.org
5
5
  @license MIT
@@ -228,7 +228,7 @@
228
228
  date1.setFullYear(year1);
229
229
  return date1;
230
230
  }
231
- // tests for quarterly formats (ie. "QX YYYY")
231
+ // tests for quarterly formats (ie. "QX YYYY" and "YYYY QX")
232
232
  var quarterPrefix = new RegExp(/^([qQ]{1}[1-4]{1}|[1-4]{1}[qQ]{1})[\s|-]{0,1}(-*\d{1,4})$/g).exec(s);
233
233
  var quarterSuffix = new RegExp(/^(-*\d{1,4})[\s|-]{0,1}([qQ]{1}[1-4]{1}|[1-4]{1}[qQ]{1})$/g).exec(s);
234
234
  if (quarterPrefix || quarterSuffix) {
@@ -238,14 +238,24 @@
238
238
  date2.setFullYear(year2);
239
239
  return date2;
240
240
  }
241
+ // tests for monthly formats (ie. "MM-YYYY" and "YYYY-MM")
242
+ var monthPrefix = new RegExp(/^([-*\d]{1,2})\-(-*\d{1,4})$/g).exec(s);
243
+ var monthSuffix = new RegExp(/^(-*\d{1,4})\-([-*\d]{1,2})$/g).exec(s);
244
+ if (monthPrefix || monthSuffix) {
245
+ var month = +(monthPrefix ? monthPrefix[1] : monthSuffix[2]);
246
+ var year3 = +(monthPrefix ? monthPrefix[2] : monthSuffix[1]);
247
+ var date3 = new Date(year3, month - 1, 1);
248
+ date3.setFullYear(year3);
249
+ return date3;
250
+ }
241
251
  // detects if only passing a year value
242
252
  if (!s.includes("/") && !s.includes(" ") && (!s.includes("-") || !s.indexOf("-"))) {
243
- var date3 = new Date(+s, 0, 1);
244
- date3.setFullYear(d);
245
- return date3;
253
+ var date4 = new Date(+s, 0, 1);
254
+ date4.setFullYear(d);
255
+ return date4;
246
256
  }
247
- // falls back to Date object
248
- return new Date(s);
257
+ // falls back to Date object, replacing hyphens with slashes
258
+ return new Date(s.replace(/-/g, "/"));
249
259
  }
250
260
 
251
261
  var xhtml = "http://www.w3.org/1999/xhtml";