Skip to content

Commit 2f13243

Browse files
committed
Version 5.10.12
1 parent cef74b2 commit 2f13243

File tree

8 files changed

+49
-13
lines changed

8 files changed

+49
-13
lines changed

Diff for: package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"private": true,
33
"name": "@amcharts/amcharts5",
4-
"version": "5.10.11",
4+
"version": "5.10.12",
55
"author": "amCharts <[email protected]> (https://www.amcharts.com/)",
66
"description": "amCharts 5",
77
"homepage": "https://www.amcharts.com/",

Diff for: packages/shared/CHANGELOG.md

+9
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,15 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/).
55
Please note, that this project, while following numbering syntax, it DOES NOT
66
adhere to [Semantic Versioning](http://semver.org/spec/v2.0.0.html) rules.
77

8+
## [5.10.12] - 2025-01-23
9+
10+
### Fixed
11+
- `useSelectionExtremes` (added in 5.10.11) was not working with vertical `ValueAxis`.
12+
- In case `addChildData()` of a `Hierarchy` was used with `topLevel = 0`, newly added nodes were invisible.
13+
- `DateFormatter` was not considering daylight savings of the timezone when formatting timezone offset related codes.
14+
- If `Root` timezone was set and series were using hourly (or more granular) data, items could be placed incorrectly at the daylight-savings switch.
15+
16+
817
## [5.10.11] - 2025-01-13
918

1019
### Added

Diff for: src/.internal/charts/hierarchy/Hierarchy.ts

+8-1
Original file line numberDiff line numberDiff line change
@@ -602,7 +602,14 @@ export abstract class Hierarchy extends Series {
602602
childDataItem.setRaw("depth", depth + 1);
603603

604604
if (childDataItem.get("fill") == null) {
605-
childDataItem.setRaw("fill", dataItem.get("fill"));
605+
let fill = dataItem.get("fill");
606+
if(fill == null) {
607+
const colors = this.get("colors");
608+
if(colors){
609+
fill = colors.next();
610+
}
611+
}
612+
childDataItem.setRaw("fill", fill);
606613
}
607614

608615
this.processDataItem(childDataItem);

Diff for: src/.internal/charts/xy/series/XYSeries.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1431,7 +1431,7 @@ export abstract class XYSeries extends Series {
14311431
}
14321432

14331433
if (baseAxis === xAxis || !baseAxis) {
1434-
if (this.get("valueYShow") !== "valueYWorking") {
1434+
if (this.get("valueYShow") !== "valueYWorking" || this.get("useSelectionExtremes")) {
14351435
const selectionMinY = this.getPrivate("selectionMinY");
14361436
if (selectionMinY != null) {
14371437
this.setPrivateRaw("minY", selectionMinY);

Diff for: src/.internal/core/Registry.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ export class Registry {
66
/**
77
* Currently running version of amCharts.
88
*/
9-
readonly version: string = "5.10.11";
9+
readonly version: string = "5.10.12";
1010

1111
/**
1212
* List of applied licenses.

Diff for: src/.internal/core/util/DateFormatter.ts

+9-7
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,7 @@ export class DateFormatter extends Entity {
103103
// TODO: decide if we need to cast
104104
let date: Date = source;
105105

106+
106107
// Is it a built-in format or Intl.DateTimeFormat
107108
if ($type.isObject(format)) {
108109

@@ -126,6 +127,7 @@ export class DateFormatter extends Entity {
126127

127128
// Should we apply custom time zone?
128129
const timezone = this._root.timezone;
130+
let originalDate = date;
129131
if (timezone && !this._root.utc && !ignoreTimezone) {
130132
date = timezone.convertLocal(date);
131133
}
@@ -138,7 +140,7 @@ export class DateFormatter extends Entity {
138140
}
139141

140142
// Apply format
141-
formatted = this.applyFormat(date, info, ignoreTimezone);
143+
formatted = this.applyFormat(date, info, ignoreTimezone, originalDate);
142144

143145
// Capitalize
144146
if (this.get("capitalize")) {
@@ -158,7 +160,7 @@ export class DateFormatter extends Entity {
158160
* @param info Parsed format information
159161
* @return Formatted date string
160162
*/
161-
protected applyFormat(date: Date, info: DateFormatInfo, ignoreTimezone: boolean = false): string {
163+
protected applyFormat(date: Date, info: DateFormatInfo, ignoreTimezone: boolean = false, originalDate?: Date): string {
162164

163165
// Init return value
164166
let res = info.template;
@@ -431,19 +433,19 @@ export class DateFormatter extends Entity {
431433
break;
432434

433435
case "z":
434-
value = $utils.getTimeZone(date, false, false, this._root.utc, this._root.timezone ? this._root.timezone.name : undefined).replace(/[+-]+[0-9]+$/, "");
436+
value = $utils.getTimeZone(originalDate || date, false, false, this._root.utc, this._root.timezone ? this._root.timezone.name : undefined).replace(/[+-]+[0-9]+$/, "");
435437
break;
436438

437439
case "zz":
438-
value = $utils.getTimeZone(date, true, false, this._root.utc, this._root.timezone ? this._root.timezone.name : undefined);
440+
value = $utils.getTimeZone(originalDate || date, true, false, this._root.utc, this._root.timezone ? this._root.timezone.name : undefined);
439441
break;
440442

441443
case "zzz":
442-
value = $utils.getTimeZone(date, false, true, this._root.utc, this._root.timezone ? this._root.timezone.name : undefined).replace(/[+-]+[0-9]+$/, "");
444+
value = $utils.getTimeZone(originalDate || date, false, true, this._root.utc, this._root.timezone ? this._root.timezone.name : undefined).replace(/[+-]+[0-9]+$/, "");
443445
break;
444446

445447
case "zzzz":
446-
value = $utils.getTimeZone(date, true, true, this._root.utc, this._root.timezone ? this._root.timezone.name : undefined);
448+
value = $utils.getTimeZone(originalDate || date, true, true, this._root.utc, this._root.timezone ? this._root.timezone.name : undefined);
447449
break;
448450

449451
case "Z":
@@ -452,7 +454,7 @@ export class DateFormatter extends Entity {
452454
if (timezone instanceof Timezone) {
453455
timezone = timezone.name;
454456
}
455-
const offset = timezone ? $utils.getTimezoneOffset(timezone) : date.getTimezoneOffset();
457+
const offset = timezone ? $utils.getTimezoneOffset(timezone, originalDate || date) : date.getTimezoneOffset();
456458

457459
let tz = Math.abs(offset) / 60;
458460
let tzh = Math.floor(tz);

Diff for: src/.internal/core/util/Time.ts

+18
Original file line numberDiff line numberDiff line change
@@ -519,6 +519,7 @@ export function round(date: Date, unit: TimeUnit, count: number, firstDateOfWeek
519519
if (isNaN(date.getTime())) {
520520
return date;
521521
}
522+
let initialTime = date.getTime();
522523
let tzoffset = timezone.offsetUTC(date);
523524
let timeZoneOffset = date.getTimezoneOffset();
524525
let parsedDate = timezone.parseDate(date);
@@ -577,6 +578,7 @@ export function round(date: Date, unit: TimeUnit, count: number, firstDateOfWeek
577578
if (count > 1) {
578579
hour = Math.floor(hour / count) * count;
579580
}
581+
580582
minute = offsetDif;
581583
second = 0;
582584
millisecond = 0;
@@ -632,8 +634,24 @@ export function round(date: Date, unit: TimeUnit, count: number, firstDateOfWeek
632634
break;
633635
}
634636

637+
638+
635639
date = new Date(year, month, day, hour, minute, second, millisecond);
636640

641+
// fix to solve #101989
642+
const newTime = date.getTime();
643+
let hDuration = 3600000;
644+
if (unit == "hour") {
645+
hDuration = 3600000 * count;
646+
}
647+
648+
if (newTime + hDuration <= initialTime) {
649+
if (unit == "hour" || unit == "minute" || unit == "second" || unit == "millisecond") {
650+
date = new Date(newTime + hDuration);
651+
}
652+
}
653+
// end of fix
654+
637655
let newTimeZoneOffset = date.getTimezoneOffset();
638656
let newTzoffset = timezone.offsetUTC(date);
639657
let newDiff = newTzoffset - newTimeZoneOffset;

Diff for: src/.internal/core/util/Utils.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -1039,8 +1039,8 @@ export function getTimeZone(date: Date, long: boolean = false, savings: boolean
10391039
return trim(wtz);
10401040
}
10411041

1042-
export function getTimezoneOffset(timezone: string): number {
1043-
const date = new Date(Date.UTC(2012, 0, 1, 0, 0, 0, 0));
1042+
export function getTimezoneOffset(timezone: string, targetDate?: Date): number {
1043+
const date = targetDate || new Date(Date.UTC(2012, 0, 1, 0, 0, 0, 0));
10441044
const utcDate = new Date(date.toLocaleString("en-US", { timeZone: "UTC" }));
10451045
const tzDate = new Date(date.toLocaleString("en-US", { timeZone: timezone }));
10461046
return (tzDate.getTime() - utcDate.getTime()) / 6e4 * -1;

0 commit comments

Comments
 (0)