@react-stately/datepicker 3.0.0-rc.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/dist/module.js CHANGED
@@ -2,6 +2,7 @@ import {toCalendarDate as $7UzoM$toCalendarDate, toCalendarDateTime as $7UzoM$to
2
2
  import {useControlledState as $7UzoM$useControlledState} from "@react-stately/utils";
3
3
  import {useOverlayTriggerState as $7UzoM$useOverlayTriggerState} from "@react-stately/overlays";
4
4
  import {useState as $7UzoM$useState, useRef as $7UzoM$useRef, useMemo as $7UzoM$useMemo, useEffect as $7UzoM$useEffect} from "react";
5
+ import {LocalizedStringDictionary as $7UzoM$LocalizedStringDictionary} from "@internationalized/string";
5
6
 
6
7
 
7
8
 
@@ -39,6 +40,7 @@ function $35a22f14a1f04b11$export$7e319ea407e63bc0(fieldOptions, options) {
39
40
  opts1.timeZone = options.timeZone || 'UTC';
40
41
  let hasTime = granularity === 'hour' || granularity === 'minute' || granularity === 'second';
41
42
  if (hasTime && options.timeZone && !options.hideTimeZone) opts1.timeZoneName = 'short';
43
+ if (options.showEra && startIdx === 0) opts1.era = 'short';
42
44
  return opts1;
43
45
  }
44
46
  function $35a22f14a1f04b11$export$c5221a78ef73c5e9(placeholderValue) {
@@ -141,7 +143,8 @@ function $ab5bf3f618090389$export$87194bb378cc3ac2(props) {
141
143
  granularity: granularity,
142
144
  timeZone: defaultTimeZone,
143
145
  hideTimeZone: props.hideTimeZone,
144
- hourCycle: props.hourCycle
146
+ hourCycle: props.hourCycle,
147
+ showEra: value.calendar.identifier === 'gregory' && value.era === 'BC'
145
148
  });
146
149
  let formatter = new $7UzoM$DateFormatter(locale, formatOptions);
147
150
  return formatter.format(dateValue);
@@ -153,6 +156,396 @@ function $ab5bf3f618090389$export$87194bb378cc3ac2(props) {
153
156
 
154
157
 
155
158
 
159
+ // These placeholders are based on the strings used by the <input type="date">
160
+ // implementations in Chrome and Firefox. Additional languages are supported
161
+ // here than React Spectrum's typical translations.
162
+ const $3e3ed55ab2966714$var$placeholders = new $7UzoM$LocalizedStringDictionary({
163
+ ach: {
164
+ year: 'mwaka',
165
+ month: 'dwe',
166
+ day: 'nino'
167
+ },
168
+ af: {
169
+ year: 'jjjj',
170
+ month: 'mm',
171
+ day: 'dd'
172
+ },
173
+ am: {
174
+ year: 'ዓዓዓዓ',
175
+ month: 'ሚሜ',
176
+ day: 'ቀቀ'
177
+ },
178
+ an: {
179
+ year: 'aaaa',
180
+ month: 'mm',
181
+ day: 'dd'
182
+ },
183
+ ar: {
184
+ year: 'سنة',
185
+ month: 'شهر',
186
+ day: 'يوم'
187
+ },
188
+ ast: {
189
+ year: 'aaaa',
190
+ month: 'mm',
191
+ day: 'dd'
192
+ },
193
+ az: {
194
+ year: 'iiii',
195
+ month: 'aa',
196
+ day: 'gg'
197
+ },
198
+ be: {
199
+ year: 'гггг',
200
+ month: 'мм',
201
+ day: 'дд'
202
+ },
203
+ bg: {
204
+ year: 'гггг',
205
+ month: 'мм',
206
+ day: 'дд'
207
+ },
208
+ bn: {
209
+ year: 'yyyy',
210
+ month: 'মিমি',
211
+ day: 'dd'
212
+ },
213
+ br: {
214
+ year: 'bbbb',
215
+ month: 'mm',
216
+ day: 'dd'
217
+ },
218
+ bs: {
219
+ year: 'gggg',
220
+ month: 'mm',
221
+ day: 'dd'
222
+ },
223
+ ca: {
224
+ year: 'aaaa',
225
+ month: 'mm',
226
+ day: 'dd'
227
+ },
228
+ cak: {
229
+ year: 'jjjj',
230
+ month: 'ii',
231
+ day: "q'q'"
232
+ },
233
+ ckb: {
234
+ year: 'ساڵ',
235
+ month: 'مانگ',
236
+ day: 'ڕۆژ'
237
+ },
238
+ cs: {
239
+ year: 'rrrr',
240
+ month: 'mm',
241
+ day: 'dd'
242
+ },
243
+ cy: {
244
+ year: 'bbbb',
245
+ month: 'mm',
246
+ day: 'dd'
247
+ },
248
+ da: {
249
+ year: 'åååå',
250
+ month: 'mm',
251
+ day: 'dd'
252
+ },
253
+ de: {
254
+ year: 'jjjj',
255
+ month: 'mm',
256
+ day: 'tt'
257
+ },
258
+ dsb: {
259
+ year: 'llll',
260
+ month: 'mm',
261
+ day: 'źź'
262
+ },
263
+ el: {
264
+ year: 'εεεε',
265
+ month: 'μμ',
266
+ day: 'ηη'
267
+ },
268
+ en: {
269
+ year: 'yyyy',
270
+ month: 'mm',
271
+ day: 'dd'
272
+ },
273
+ eo: {
274
+ year: 'jjjj',
275
+ month: 'mm',
276
+ day: 'tt'
277
+ },
278
+ es: {
279
+ year: 'aaaa',
280
+ month: 'mm',
281
+ day: 'dd'
282
+ },
283
+ et: {
284
+ year: 'aaaa',
285
+ month: 'kk',
286
+ day: 'pp'
287
+ },
288
+ eu: {
289
+ year: 'uuuu',
290
+ month: 'hh',
291
+ day: 'ee'
292
+ },
293
+ fa: {
294
+ year: 'سال',
295
+ month: 'ماه',
296
+ day: 'روز'
297
+ },
298
+ ff: {
299
+ year: 'hhhh',
300
+ month: 'll',
301
+ day: 'ññ'
302
+ },
303
+ fi: {
304
+ year: 'vvvv',
305
+ month: 'kk',
306
+ day: 'pp'
307
+ },
308
+ fr: {
309
+ year: 'aaaa',
310
+ month: 'mm',
311
+ day: 'jj'
312
+ },
313
+ fy: {
314
+ year: 'jjjj',
315
+ month: 'mm',
316
+ day: 'dd'
317
+ },
318
+ ga: {
319
+ year: 'bbbb',
320
+ month: 'mm',
321
+ day: 'll'
322
+ },
323
+ gd: {
324
+ year: 'bbbb',
325
+ month: 'mm',
326
+ day: 'll'
327
+ },
328
+ gl: {
329
+ year: 'aaaa',
330
+ month: 'mm',
331
+ day: 'dd'
332
+ },
333
+ he: {
334
+ year: 'שנה',
335
+ month: 'חודש',
336
+ day: 'יום'
337
+ },
338
+ hr: {
339
+ year: 'gggg',
340
+ month: 'mm',
341
+ day: 'dd'
342
+ },
343
+ hsb: {
344
+ year: 'llll',
345
+ month: 'mm',
346
+ day: 'dd'
347
+ },
348
+ hu: {
349
+ year: 'éééé',
350
+ month: 'hh',
351
+ day: 'nn'
352
+ },
353
+ ia: {
354
+ year: 'aaaa',
355
+ month: 'mm',
356
+ day: 'dd'
357
+ },
358
+ id: {
359
+ year: 'tttt',
360
+ month: 'bb',
361
+ day: 'hh'
362
+ },
363
+ it: {
364
+ year: 'aaaa',
365
+ month: 'mm',
366
+ day: 'gg'
367
+ },
368
+ ja: {
369
+ year: ' 年 ',
370
+ month: '月',
371
+ day: '日'
372
+ },
373
+ ka: {
374
+ year: 'წწწწ',
375
+ month: 'თთ',
376
+ day: 'რრ'
377
+ },
378
+ kk: {
379
+ year: 'жжжж',
380
+ month: 'аа',
381
+ day: 'кк'
382
+ },
383
+ kn: {
384
+ year: 'ವವವವ',
385
+ month: 'ಮಿಮೀ',
386
+ day: 'ದಿದಿ'
387
+ },
388
+ ko: {
389
+ year: '연도',
390
+ month: '월',
391
+ day: '일'
392
+ },
393
+ lb: {
394
+ year: 'jjjj',
395
+ month: 'mm',
396
+ day: 'dd'
397
+ },
398
+ lo: {
399
+ year: 'ປປປປ',
400
+ month: 'ດດ',
401
+ day: 'ວວ'
402
+ },
403
+ lt: {
404
+ year: 'mmmm',
405
+ month: 'mm',
406
+ day: 'dd'
407
+ },
408
+ lv: {
409
+ year: 'gggg',
410
+ month: 'mm',
411
+ day: 'dd'
412
+ },
413
+ meh: {
414
+ year: 'aaaa',
415
+ month: 'mm',
416
+ day: 'dd'
417
+ },
418
+ ml: {
419
+ year: 'വർഷം',
420
+ month: 'മാസം',
421
+ day: 'തീയതി'
422
+ },
423
+ ms: {
424
+ year: 'tttt',
425
+ month: 'mm',
426
+ day: 'hh'
427
+ },
428
+ nl: {
429
+ year: 'jjjj',
430
+ month: 'mm',
431
+ day: 'dd'
432
+ },
433
+ nn: {
434
+ year: 'åååå',
435
+ month: 'mm',
436
+ day: 'dd'
437
+ },
438
+ no: {
439
+ year: 'åååå',
440
+ month: 'mm',
441
+ day: 'dd'
442
+ },
443
+ oc: {
444
+ year: 'aaaa',
445
+ month: 'mm',
446
+ day: 'jj'
447
+ },
448
+ pl: {
449
+ year: 'rrrr',
450
+ month: 'mm',
451
+ day: 'dd'
452
+ },
453
+ pt: {
454
+ year: 'aaaa',
455
+ month: 'mm',
456
+ day: 'dd'
457
+ },
458
+ rm: {
459
+ year: 'oooo',
460
+ month: 'mm',
461
+ day: 'dd'
462
+ },
463
+ ro: {
464
+ year: 'aaaa',
465
+ month: 'll',
466
+ day: 'zz'
467
+ },
468
+ ru: {
469
+ year: 'гггг',
470
+ month: 'мм',
471
+ day: 'дд'
472
+ },
473
+ sc: {
474
+ year: 'aaaa',
475
+ month: 'mm',
476
+ day: 'dd'
477
+ },
478
+ scn: {
479
+ year: 'aaaa',
480
+ month: 'mm',
481
+ day: 'jj'
482
+ },
483
+ sk: {
484
+ year: 'rrrr',
485
+ month: 'mm',
486
+ day: 'dd'
487
+ },
488
+ sl: {
489
+ year: 'llll',
490
+ month: 'mm',
491
+ day: 'dd'
492
+ },
493
+ sr: {
494
+ year: 'гггг',
495
+ month: 'мм',
496
+ day: 'дд'
497
+ },
498
+ sv: {
499
+ year: 'åååå',
500
+ month: 'mm',
501
+ day: 'dd'
502
+ },
503
+ szl: {
504
+ year: 'rrrr',
505
+ month: 'mm',
506
+ day: 'dd'
507
+ },
508
+ tg: {
509
+ year: 'сссс',
510
+ month: 'мм',
511
+ day: 'рр'
512
+ },
513
+ th: {
514
+ year: 'ปปปป',
515
+ month: 'ดด',
516
+ day: 'วว'
517
+ },
518
+ tr: {
519
+ year: 'yyyy',
520
+ month: 'aa',
521
+ day: 'gg'
522
+ },
523
+ uk: {
524
+ year: 'рррр',
525
+ month: 'мм',
526
+ day: 'дд'
527
+ },
528
+ 'zh-CN': {
529
+ year: '年',
530
+ month: '月',
531
+ day: '日'
532
+ },
533
+ 'zh-TW': {
534
+ year: '年',
535
+ month: '月',
536
+ day: '日'
537
+ }
538
+ }, 'en');
539
+ function $3e3ed55ab2966714$export$d3f5c5e0a5023fa0(field, value, locale) {
540
+ // Use the actual placeholder value for the era and day period fields.
541
+ if (field === 'era' || field === 'dayPeriod') return value;
542
+ if (field === 'year' || field === 'month' || field === 'day') return $3e3ed55ab2966714$var$placeholders.getStringForLocale(field, locale);
543
+ // For time fields (e.g. hour, minute, etc.), use two dashes as the placeholder.
544
+ return '––';
545
+ }
546
+
547
+
548
+
156
549
 
157
550
  const $3c0fc76039f1c516$var$EDITABLE_SEGMENTS = {
158
551
  year: true,
@@ -183,20 +576,45 @@ function $3c0fc76039f1c516$export$60e84778edff6d26(props) {
183
576
  let timeZone = defaultTimeZone || 'UTC';
184
577
  // props.granularity must actually exist in the value if one is provided.
185
578
  if (v1 && !(granularity in v1)) throw new Error('Invalid granularity ' + granularity + ' for value ' + v1.toString());
579
+ let defaultFormatter = $7UzoM$useMemo(()=>new $7UzoM$DateFormatter(locale)
580
+ , [
581
+ locale
582
+ ]);
583
+ let calendar = $7UzoM$useMemo(()=>createCalendar(defaultFormatter.resolvedOptions().calendar)
584
+ , [
585
+ createCalendar,
586
+ defaultFormatter
587
+ ]);
588
+ let [value1, setDate] = $7UzoM$useControlledState(props.value, props.defaultValue, props.onChange);
589
+ let calendarValue = $7UzoM$useMemo(()=>$35a22f14a1f04b11$export$61a490a80c552550(value1, calendar)
590
+ , [
591
+ value1,
592
+ calendar
593
+ ]);
594
+ // We keep track of the placeholder date separately in state so that onChange is not called
595
+ // until all segments are set. If the value === null (not undefined), then assume the component
596
+ // is controlled, so use the placeholder as the value until all segments are entered so it doesn't
597
+ // change from uncontrolled to controlled and emit a warning.
598
+ let [placeholderDate, setPlaceholderDate] = $7UzoM$useState(()=>$35a22f14a1f04b11$export$66aa2b09de4b1ea5(props.placeholderValue, granularity, calendar, defaultTimeZone)
599
+ );
600
+ let val = calendarValue || placeholderDate;
601
+ let showEra = calendar.identifier === 'gregory' && val.era === 'BC';
186
602
  var _maxGranularity;
187
603
  let formatOpts = $7UzoM$useMemo(()=>({
188
604
  granularity: granularity,
189
605
  maxGranularity: (_maxGranularity = props.maxGranularity) !== null && _maxGranularity !== void 0 ? _maxGranularity : 'year',
190
606
  timeZone: defaultTimeZone,
191
607
  hideTimeZone: hideTimeZone,
192
- hourCycle: props.hourCycle
608
+ hourCycle: props.hourCycle,
609
+ showEra: showEra
193
610
  })
194
611
  , [
195
612
  props.maxGranularity,
196
613
  granularity,
197
614
  props.hourCycle,
198
615
  defaultTimeZone,
199
- hideTimeZone
616
+ hideTimeZone,
617
+ showEra
200
618
  ]);
201
619
  let opts = $7UzoM$useMemo(()=>$35a22f14a1f04b11$export$7e319ea407e63bc0({
202
620
  }, formatOpts)
@@ -212,11 +630,6 @@ function $3c0fc76039f1c516$export$60e84778edff6d26(props) {
212
630
  , [
213
631
  dateFormatter
214
632
  ]);
215
- let calendar = $7UzoM$useMemo(()=>createCalendar(resolvedOptions.calendar)
216
- , [
217
- createCalendar,
218
- resolvedOptions.calendar
219
- ]);
220
633
  // Determine how many editable segments there are for validation purposes.
221
634
  // The result is cached for performance.
222
635
  let allSegments = $7UzoM$useMemo(()=>dateFormatter.formatToParts(new Date()).filter((seg)=>$3c0fc76039f1c516$var$EDITABLE_SEGMENTS[seg.type]
@@ -231,12 +644,6 @@ function $3c0fc76039f1c516$export$60e84778edff6d26(props) {
231
644
  } : {
232
645
  }
233
646
  );
234
- // We keep track of the placeholder date separately in state so that onChange is not called
235
- // until all segments are set. If the value === null (not undefined), then assume the component
236
- // is controlled, so use the placeholder as the value until all segments are entered so it doesn't
237
- // change from uncontrolled to controlled and emit a warning.
238
- let [placeholderDate, setPlaceholderDate] = $7UzoM$useState(()=>$35a22f14a1f04b11$export$66aa2b09de4b1ea5(props.placeholderValue, granularity, calendar, defaultTimeZone)
239
- );
240
647
  // Reset placeholder when calendar changes
241
648
  let lastCalendarIdentifier = $7UzoM$useRef(calendar.identifier);
242
649
  $7UzoM$useEffect(()=>{
@@ -252,12 +659,6 @@ function $3c0fc76039f1c516$export$60e84778edff6d26(props) {
252
659
  defaultTimeZone,
253
660
  props.placeholderValue
254
661
  ]);
255
- let [value1, setDate] = $7UzoM$useControlledState(props.value, props.defaultValue, props.onChange);
256
- let calendarValue = $7UzoM$useMemo(()=>$35a22f14a1f04b11$export$61a490a80c552550(value1, calendar)
257
- , [
258
- value1,
259
- calendar
260
- ]);
261
662
  // If there is a value prop, and some segments were previously placeholders, mark them all as valid.
262
663
  if (value1 && Object.keys(validSegments).length < Object.keys(allSegments).length) {
263
664
  validSegments = {
@@ -291,11 +692,14 @@ function $3c0fc76039f1c516$export$60e84778edff6d26(props) {
291
692
  let segments = $7UzoM$useMemo(()=>dateFormatter.formatToParts(dateValue).map((segment)=>{
292
693
  let isEditable = $3c0fc76039f1c516$var$EDITABLE_SEGMENTS[segment.type];
293
694
  if (segment.type === 'era' && calendar.getEras().length === 1) isEditable = false;
695
+ let isPlaceholder = $3c0fc76039f1c516$var$EDITABLE_SEGMENTS[segment.type] && !validSegments[segment.type];
696
+ let placeholder = $3c0fc76039f1c516$var$EDITABLE_SEGMENTS[segment.type] ? $3e3ed55ab2966714$export$d3f5c5e0a5023fa0(segment.type, segment.value, locale) : null;
294
697
  return {
295
698
  type: $3c0fc76039f1c516$var$TYPE_MAPPING[segment.type] || segment.type,
296
- text: segment.value,
699
+ text: isPlaceholder ? placeholder : segment.value,
297
700
  ...$3c0fc76039f1c516$var$getSegmentLimits(displayValue, segment.type, resolvedOptions),
298
- isPlaceholder: $3c0fc76039f1c516$var$EDITABLE_SEGMENTS[segment.type] && !validSegments[segment.type],
701
+ isPlaceholder: isPlaceholder,
702
+ placeholder: placeholder,
299
703
  isEditable: isEditable
300
704
  };
301
705
  })
@@ -305,29 +709,41 @@ function $3c0fc76039f1c516$export$60e84778edff6d26(props) {
305
709
  dateFormatter,
306
710
  resolvedOptions,
307
711
  displayValue,
308
- calendar
309
- ]);
310
- let hasEra = $7UzoM$useMemo(()=>segments.some((s)=>s.type === 'era'
311
- )
312
- , [
313
- segments
712
+ calendar,
713
+ locale
314
714
  ]);
715
+ // When the era field appears, mark it valid if the year field is already valid.
716
+ // If the era field disappears, remove it from the valid segments.
717
+ if (allSegments.era && validSegments.year && !validSegments.era) {
718
+ validSegments.era = true;
719
+ setValidSegments({
720
+ ...validSegments
721
+ });
722
+ } else if (!allSegments.era && validSegments.era) {
723
+ delete validSegments.era;
724
+ setValidSegments({
725
+ ...validSegments
726
+ });
727
+ }
315
728
  let markValid = (part)=>{
316
729
  validSegments[part] = true;
317
- if (part === 'year' && hasEra) validSegments.era = true;
730
+ if (part === 'year' && allSegments.era) validSegments.era = true;
318
731
  setValidSegments({
319
732
  ...validSegments
320
733
  });
321
734
  };
322
735
  let adjustSegment = (type, amount)=>{
323
- markValid(type);
324
- setValue($3c0fc76039f1c516$var$addSegment(displayValue, type, amount, resolvedOptions));
736
+ if (!validSegments[type]) {
737
+ markValid(type);
738
+ if (Object.keys(validSegments).length >= Object.keys(allSegments).length) setValue(displayValue);
739
+ } else setValue($3c0fc76039f1c516$var$addSegment(displayValue, type, amount, resolvedOptions));
325
740
  };
326
741
  let validationState = props.validationState || ($35a22f14a1f04b11$export$eac50920cf2fd59a(calendarValue, props.minValue, props.maxValue) ? 'invalid' : null);
327
742
  var _maxGranularity1;
328
743
  return {
329
744
  value: calendarValue,
330
745
  dateValue: dateValue,
746
+ calendar: calendar,
331
747
  setValue: setValue,
332
748
  segments: segments,
333
749
  dateFormatter: dateFormatter,
@@ -353,20 +769,16 @@ function $3c0fc76039f1c516$export$60e84778edff6d26(props) {
353
769
  markValid(part);
354
770
  setValue($3c0fc76039f1c516$var$setSegment(displayValue, part, v, resolvedOptions));
355
771
  },
356
- confirmPlaceholder (part) {
772
+ confirmPlaceholder () {
357
773
  if (props.isDisabled || props.isReadOnly) return;
358
- if (!part) {
359
- // Confirm the rest of the placeholder if any of the segments are valid.
360
- let numValid = Object.keys(validSegments).length;
361
- if (numValid > 0 && numValid < Object.keys(allSegments).length) {
362
- validSegments = {
363
- ...allSegments
364
- };
365
- setValidSegments(validSegments);
366
- setValue(displayValue.copy());
367
- }
368
- } else if (!validSegments[part]) {
369
- markValid(part);
774
+ // Confirm the placeholder if only the day period is not filled in.
775
+ let validKeys = Object.keys(validSegments);
776
+ let allKeys = Object.keys(allSegments);
777
+ if (validKeys.length === allKeys.length - 1 && allSegments.dayPeriod && !validSegments.dayPeriod) {
778
+ validSegments = {
779
+ ...allSegments
780
+ };
781
+ setValidSegments(validSegments);
370
782
  setValue(displayValue.copy());
371
783
  }
372
784
  },
@@ -501,6 +913,7 @@ function $3c0fc76039f1c516$var$setSegment(value, part, segmentValue, options) {
501
913
  case 'day':
502
914
  case 'month':
503
915
  case 'year':
916
+ case 'era':
504
917
  return value.set({
505
918
  [part]: segmentValue
506
919
  });
@@ -557,16 +970,13 @@ function $93c38a5e28be6249$export$e50a61c1de9f574(props) {
557
970
  setPlaceholderValue(placeholderValue);
558
971
  }
559
972
  let value1 = controlledValue || placeholderValue;
560
- let valueRef = $7UzoM$useRef(value1);
561
- valueRef.current = value1;
562
973
  let setValue = (value)=>{
563
- valueRef.current = value;
564
974
  setPlaceholderValue(value);
565
975
  if ((value === null || value === void 0 ? void 0 : value.start) && value.end) setControlledValue(value);
566
976
  else setControlledValue(null);
567
977
  };
568
978
  let v = (value1 === null || value1 === void 0 ? void 0 : value1.start) || (value1 === null || value1 === void 0 ? void 0 : value1.end) || props.placeholderValue;
569
- let [granularity, defaultTimeZone] = $35a22f14a1f04b11$export$2440da353cedad43(v, props.granularity);
979
+ let [granularity] = $35a22f14a1f04b11$export$2440da353cedad43(v, props.granularity);
570
980
  let hasTime = granularity === 'hour' || granularity === 'minute' || granularity === 'second' || granularity === 'millisecond';
571
981
  var _shouldCloseOnSelect;
572
982
  let shouldCloseOnSelect = (_shouldCloseOnSelect = props.shouldCloseOnSelect) !== null && _shouldCloseOnSelect !== void 0 ? _shouldCloseOnSelect : true;
@@ -649,7 +1059,8 @@ function $93c38a5e28be6249$export$e50a61c1de9f574(props) {
649
1059
  granularity: startGranularity,
650
1060
  timeZone: startTimeZone,
651
1061
  hideTimeZone: props.hideTimeZone,
652
- hourCycle: props.hourCycle
1062
+ hourCycle: props.hourCycle,
1063
+ showEra: value1.start.calendar.identifier === 'gregory' && value1.start.era === 'BC' || value1.end.calendar.identifier === 'gregory' && value1.end.era === 'BC'
653
1064
  });
654
1065
  let startDate = value1.start.toDate(startTimeZone || 'UTC');
655
1066
  let endDate = value1.end.toDate(endTimeZone || 'UTC');
@@ -697,19 +1108,6 @@ function $93c38a5e28be6249$export$e50a61c1de9f574(props) {
697
1108
  start: startFormatter.format(startDate),
698
1109
  end: endFormatter.format(endDate)
699
1110
  };
700
- },
701
- confirmPlaceholder () {
702
- // Need to use ref value here because the value can be set in the same tick as
703
- // a blur, which means the component won't have re-rendered yet.
704
- let value = valueRef.current;
705
- if (value && Boolean(value.start) !== Boolean(value.end)) {
706
- let calendar = (value.start || value.end).calendar;
707
- let placeholder = $35a22f14a1f04b11$export$66aa2b09de4b1ea5(props.placeholderValue, granularity, calendar, defaultTimeZone);
708
- setValue({
709
- start: value.start || placeholder,
710
- end: value.end || placeholder
711
- });
712
- }
713
1111
  }
714
1112
  };
715
1113
  }