|
1 |
| -import warning from 'warning'; |
2 |
| - |
3 |
| -import { CALENDAR_TYPES, DEPRECATED_CALENDAR_TYPES } from './const.js'; |
4 | 1 | import { getRange } from './dates.js';
|
5 | 2 |
|
6 |
| -import type { CalendarType, DeprecatedCalendarType, Range, RangeType, Value } from './types.js'; |
| 3 | +import type { Range, RangeType, Value } from './types.js'; |
7 | 4 |
|
8 | 5 | /**
|
9 | 6 | * Returns a value no smaller than min and no larger than max.
|
@@ -155,37 +152,3 @@ export function getTileClasses(args: {
|
155 | 152 |
|
156 | 153 | return classes;
|
157 | 154 | }
|
158 |
| - |
159 |
| -const calendarTypeMap: Record<DeprecatedCalendarType, CalendarType> = { |
160 |
| - [DEPRECATED_CALENDAR_TYPES.ARABIC]: CALENDAR_TYPES.ISLAMIC, |
161 |
| - [DEPRECATED_CALENDAR_TYPES.HEBREW]: CALENDAR_TYPES.HEBREW, |
162 |
| - [DEPRECATED_CALENDAR_TYPES.ISO_8601]: CALENDAR_TYPES.ISO_8601, |
163 |
| - [DEPRECATED_CALENDAR_TYPES.US]: CALENDAR_TYPES.GREGORY, |
164 |
| -}; |
165 |
| - |
166 |
| -function isDeprecatedCalendarType( |
167 |
| - calendarType: CalendarType | DeprecatedCalendarType | undefined, |
168 |
| -): calendarType is DeprecatedCalendarType { |
169 |
| - return calendarType !== undefined && calendarType in DEPRECATED_CALENDAR_TYPES; |
170 |
| -} |
171 |
| - |
172 |
| -let warned = false; |
173 |
| - |
174 |
| -export function mapCalendarType( |
175 |
| - calendarTypeOrDeprecatedCalendarType?: CalendarType | DeprecatedCalendarType, |
176 |
| -): CalendarType | undefined { |
177 |
| - if (isDeprecatedCalendarType(calendarTypeOrDeprecatedCalendarType)) { |
178 |
| - const calendarType = calendarTypeMap[calendarTypeOrDeprecatedCalendarType]; |
179 |
| - |
180 |
| - warning( |
181 |
| - warned, |
182 |
| - `Specifying calendarType="${calendarTypeOrDeprecatedCalendarType}" is deprecated. Use calendarType="${calendarType}" instead.`, |
183 |
| - ); |
184 |
| - |
185 |
| - warned = true; |
186 |
| - |
187 |
| - return calendarType; |
188 |
| - } |
189 |
| - |
190 |
| - return calendarTypeOrDeprecatedCalendarType; |
191 |
| -} |
0 commit comments