- 
                Notifications
    
You must be signed in to change notification settings  - Fork 18
 
Open
Description
Found a bug in date formatting.
Example: Format Date with minutes timezone offset set. Instead of "+5:45" resulted string timezone is "+5:75".
Expected result: "+5:45". As in original Date.
kendo-intl/src/dates/format-date.js
Lines 39 to 59 in 64db9ef
| function formatTimeZone(date, info, options) { | |
| const { shortHours, optionalMinutes, separator, localizedName, zZeroOffset } = options; | |
| const offset = date.getTimezoneOffset() / 60; | |
| if (offset === 0 && zZeroOffset) { | |
| return "Z"; | |
| } | |
| const sign = offset <= 0 ? "+" : "-"; | |
| const hoursMinutes = Math.abs(offset).toString().split("."); | |
| const minutes = hoursMinutes[1] || 0; | |
| let result = sign + (shortHours ? hoursMinutes[0] : pad(hoursMinutes[0], 2)); | |
| if (minutes || !optionalMinutes) { | |
| result += (separator ? ":" : EMPTY) + pad(minutes, 2); | |
| } | |
| if (localizedName) { | |
| const localizedFormat = offset === 0 ? info.calendar.gmtZeroFormat : info.calendar.gmtFormat; | |
| result = formatString(localizedFormat, result); | |
| } | |
| return result; | |
| } | 
Metadata
Metadata
Assignees
Labels
No labels