Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@react-stately/datepicker

Package Overview
Dependencies
Maintainers
2
Versions
598
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@react-stately/datepicker - npm Package Compare versions

Comparing version 3.0.0-nightly.1569 to 3.0.0-nightly.1571

53

dist/main.js

@@ -50,2 +50,3 @@ var $h2qOe$internationalizeddate = require("@internationalized/date");

if (hasTime && options.timeZone && !options.hideTimeZone) opts1.timeZoneName = 'short';
if (options.showEra && startIdx === 0) opts1.era = 'short';
return opts1;

@@ -153,3 +154,4 @@ }

hideTimeZone: props.hideTimeZone,
hourCycle: props.hourCycle
hourCycle: props.hourCycle,
showEra: value.calendar.identifier === 'gregory' && value.era === 'BC'
});

@@ -196,2 +198,25 @@ let formatter = new $h2qOe$internationalizeddate.DateFormatter(locale, formatOptions);

if (v1 && !(granularity in v1)) throw new Error('Invalid granularity ' + granularity + ' for value ' + v1.toString());
let defaultFormatter = $h2qOe$react.useMemo(()=>new $h2qOe$internationalizeddate.DateFormatter(locale)
, [
locale
]);
let calendar = $h2qOe$react.useMemo(()=>createCalendar(defaultFormatter.resolvedOptions().calendar)
, [
createCalendar,
defaultFormatter
]);
let [value1, setDate] = $h2qOe$reactstatelyutils.useControlledState(props.value, props.defaultValue, props.onChange);
let calendarValue = $h2qOe$react.useMemo(()=>$50d5d6a623389320$export$61a490a80c552550(value1, calendar)
, [
value1,
calendar
]);
// We keep track of the placeholder date separately in state so that onChange is not called
// until all segments are set. If the value === null (not undefined), then assume the component
// is controlled, so use the placeholder as the value until all segments are entered so it doesn't
// change from uncontrolled to controlled and emit a warning.
let [placeholderDate, setPlaceholderDate] = $h2qOe$react.useState(()=>$50d5d6a623389320$export$66aa2b09de4b1ea5(props.placeholderValue, granularity, calendar, defaultTimeZone)
);
let val = calendarValue || placeholderDate;
let showEra = calendar.identifier === 'gregory' && val.era === 'BC';
var _maxGranularity;

@@ -203,3 +228,4 @@ let formatOpts = $h2qOe$react.useMemo(()=>({

hideTimeZone: hideTimeZone,
hourCycle: props.hourCycle
hourCycle: props.hourCycle,
showEra: showEra
})

@@ -211,3 +237,4 @@ , [

defaultTimeZone,
hideTimeZone
hideTimeZone,
showEra
]);

@@ -228,7 +255,2 @@ let opts = $h2qOe$react.useMemo(()=>$50d5d6a623389320$export$7e319ea407e63bc0({

]);
let calendar = $h2qOe$react.useMemo(()=>createCalendar(resolvedOptions.calendar)
, [
createCalendar,
resolvedOptions.calendar
]);
// Determine how many editable segments there are for validation purposes.

@@ -248,8 +270,2 @@ // The result is cached for performance.

);
// We keep track of the placeholder date separately in state so that onChange is not called
// until all segments are set. If the value === null (not undefined), then assume the component
// is controlled, so use the placeholder as the value until all segments are entered so it doesn't
// change from uncontrolled to controlled and emit a warning.
let [placeholderDate, setPlaceholderDate] = $h2qOe$react.useState(()=>$50d5d6a623389320$export$66aa2b09de4b1ea5(props.placeholderValue, granularity, calendar, defaultTimeZone)
);
// Reset placeholder when calendar changes

@@ -270,8 +286,2 @@ let lastCalendarIdentifier = $h2qOe$react.useRef(calendar.identifier);

]);
let [value1, setDate] = $h2qOe$reactstatelyutils.useControlledState(props.value, props.defaultValue, props.onChange);
let calendarValue = $h2qOe$react.useMemo(()=>$50d5d6a623389320$export$61a490a80c552550(value1, calendar)
, [
value1,
calendar
]);
// If there is a value prop, and some segments were previously placeholders, mark them all as valid.

@@ -668,3 +678,4 @@ if (value1 && Object.keys(validSegments).length < Object.keys(allSegments).length) {

hideTimeZone: props.hideTimeZone,
hourCycle: props.hourCycle
hourCycle: props.hourCycle,
showEra: value1.start.calendar.identifier === 'gregory' && value1.start.era === 'BC' || value1.end.calendar.identifier === 'gregory' && value1.end.era === 'BC'
});

@@ -671,0 +682,0 @@ let startDate = value1.start.toDate(startTimeZone || 'UTC');

@@ -42,2 +42,3 @@ import {toCalendarDate as $7UzoM$toCalendarDate, toCalendarDateTime as $7UzoM$toCalendarDateTime, DateFormatter as $7UzoM$DateFormatter, Time as $7UzoM$Time, toCalendar as $7UzoM$toCalendar, now as $7UzoM$now, GregorianCalendar as $7UzoM$GregorianCalendar, getMinimumMonthInYear as $7UzoM$getMinimumMonthInYear, getMinimumDayInMonth as $7UzoM$getMinimumDayInMonth, toTime as $7UzoM$toTime, today as $7UzoM$today, getLocalTimeZone as $7UzoM$getLocalTimeZone} from "@internationalized/date";

if (hasTime && options.timeZone && !options.hideTimeZone) opts1.timeZoneName = 'short';
if (options.showEra && startIdx === 0) opts1.era = 'short';
return opts1;

@@ -145,3 +146,4 @@ }

hideTimeZone: props.hideTimeZone,
hourCycle: props.hourCycle
hourCycle: props.hourCycle,
showEra: value.calendar.identifier === 'gregory' && value.era === 'BC'
});

@@ -188,2 +190,25 @@ let formatter = new $7UzoM$DateFormatter(locale, formatOptions);

if (v1 && !(granularity in v1)) throw new Error('Invalid granularity ' + granularity + ' for value ' + v1.toString());
let defaultFormatter = $7UzoM$useMemo(()=>new $7UzoM$DateFormatter(locale)
, [
locale
]);
let calendar = $7UzoM$useMemo(()=>createCalendar(defaultFormatter.resolvedOptions().calendar)
, [
createCalendar,
defaultFormatter
]);
let [value1, setDate] = $7UzoM$useControlledState(props.value, props.defaultValue, props.onChange);
let calendarValue = $7UzoM$useMemo(()=>$35a22f14a1f04b11$export$61a490a80c552550(value1, calendar)
, [
value1,
calendar
]);
// We keep track of the placeholder date separately in state so that onChange is not called
// until all segments are set. If the value === null (not undefined), then assume the component
// is controlled, so use the placeholder as the value until all segments are entered so it doesn't
// change from uncontrolled to controlled and emit a warning.
let [placeholderDate, setPlaceholderDate] = $7UzoM$useState(()=>$35a22f14a1f04b11$export$66aa2b09de4b1ea5(props.placeholderValue, granularity, calendar, defaultTimeZone)
);
let val = calendarValue || placeholderDate;
let showEra = calendar.identifier === 'gregory' && val.era === 'BC';
var _maxGranularity;

@@ -195,3 +220,4 @@ let formatOpts = $7UzoM$useMemo(()=>({

hideTimeZone: hideTimeZone,
hourCycle: props.hourCycle
hourCycle: props.hourCycle,
showEra: showEra
})

@@ -203,3 +229,4 @@ , [

defaultTimeZone,
hideTimeZone
hideTimeZone,
showEra
]);

@@ -220,7 +247,2 @@ let opts = $7UzoM$useMemo(()=>$35a22f14a1f04b11$export$7e319ea407e63bc0({

]);
let calendar = $7UzoM$useMemo(()=>createCalendar(resolvedOptions.calendar)
, [
createCalendar,
resolvedOptions.calendar
]);
// Determine how many editable segments there are for validation purposes.

@@ -240,8 +262,2 @@ // The result is cached for performance.

);
// We keep track of the placeholder date separately in state so that onChange is not called
// until all segments are set. If the value === null (not undefined), then assume the component
// is controlled, so use the placeholder as the value until all segments are entered so it doesn't
// change from uncontrolled to controlled and emit a warning.
let [placeholderDate, setPlaceholderDate] = $7UzoM$useState(()=>$35a22f14a1f04b11$export$66aa2b09de4b1ea5(props.placeholderValue, granularity, calendar, defaultTimeZone)
);
// Reset placeholder when calendar changes

@@ -262,8 +278,2 @@ let lastCalendarIdentifier = $7UzoM$useRef(calendar.identifier);

]);
let [value1, setDate] = $7UzoM$useControlledState(props.value, props.defaultValue, props.onChange);
let calendarValue = $7UzoM$useMemo(()=>$35a22f14a1f04b11$export$61a490a80c552550(value1, calendar)
, [
value1,
calendar
]);
// If there is a value prop, and some segments were previously placeholders, mark them all as valid.

@@ -660,3 +670,4 @@ if (value1 && Object.keys(validSegments).length < Object.keys(allSegments).length) {

hideTimeZone: props.hideTimeZone,
hourCycle: props.hourCycle
hourCycle: props.hourCycle,
showEra: value1.start.calendar.identifier === 'gregory' && value1.start.era === 'BC' || value1.end.calendar.identifier === 'gregory' && value1.end.era === 'BC'
});

@@ -663,0 +674,0 @@ let startDate = value1.start.toDate(startTimeZone || 'UTC');

{
"name": "@react-stately/datepicker",
"version": "3.0.0-nightly.1569+5d6e7ed6f",
"version": "3.0.0-nightly.1571+2b4abbc7c",
"description": "Spectrum UI components in React",

@@ -21,7 +21,7 @@ "license": "Apache-2.0",

"@babel/runtime": "^7.6.2",
"@internationalized/date": "3.0.0-nightly.3268+5d6e7ed6f",
"@react-stately/overlays": "3.2.1-nightly.3268+5d6e7ed6f",
"@react-stately/utils": "3.0.0-nightly.1569+5d6e7ed6f",
"@react-types/datepicker": "3.0.0-nightly.1569+5d6e7ed6f",
"@react-types/shared": "3.0.0-nightly.1569+5d6e7ed6f"
"@internationalized/date": "3.0.0-nightly.3270+2b4abbc7c",
"@react-stately/overlays": "3.2.1-nightly.3270+2b4abbc7c",
"@react-stately/utils": "3.0.0-nightly.1571+2b4abbc7c",
"@react-types/datepicker": "3.0.0-nightly.1571+2b4abbc7c",
"@react-types/shared": "3.0.0-nightly.1571+2b4abbc7c"
},

@@ -34,3 +34,3 @@ "peerDependencies": {

},
"gitHead": "5d6e7ed6f3f6fc5ba381fc0e5a775b318e797140"
"gitHead": "2b4abbc7c0bb10120056696a8ece65bf3efcf74a"
}

@@ -156,2 +156,23 @@ /*

let defaultFormatter = useMemo(() => new DateFormatter(locale), [locale]);
let calendar = useMemo(() => createCalendar(defaultFormatter.resolvedOptions().calendar), [createCalendar, defaultFormatter]);
let [value, setDate] = useControlledState<DateValue>(
props.value,
props.defaultValue,
props.onChange
);
let calendarValue = useMemo(() => convertValue(value, calendar), [value, calendar]);
// We keep track of the placeholder date separately in state so that onChange is not called
// until all segments are set. If the value === null (not undefined), then assume the component
// is controlled, so use the placeholder as the value until all segments are entered so it doesn't
// change from uncontrolled to controlled and emit a warning.
let [placeholderDate, setPlaceholderDate] = useState(
() => createPlaceholderDate(props.placeholderValue, granularity, calendar, defaultTimeZone)
);
let val = calendarValue || placeholderDate;
let showEra = calendar.identifier === 'gregory' && val.era === 'BC';
let formatOpts = useMemo(() => ({

@@ -162,4 +183,5 @@ granularity,

hideTimeZone,
hourCycle: props.hourCycle
}), [props.maxGranularity, granularity, props.hourCycle, defaultTimeZone, hideTimeZone]);
hourCycle: props.hourCycle,
showEra
}), [props.maxGranularity, granularity, props.hourCycle, defaultTimeZone, hideTimeZone, showEra]);
let opts = useMemo(() => getFormatOptions({}, formatOpts), [formatOpts]);

@@ -169,3 +191,2 @@

let resolvedOptions = useMemo(() => dateFormatter.resolvedOptions(), [dateFormatter]);
let calendar = useMemo(() => createCalendar(resolvedOptions.calendar), [createCalendar, resolvedOptions.calendar]);

@@ -184,10 +205,2 @@ // Determine how many editable segments there are for validation purposes.

// We keep track of the placeholder date separately in state so that onChange is not called
// until all segments are set. If the value === null (not undefined), then assume the component
// is controlled, so use the placeholder as the value until all segments are entered so it doesn't
// change from uncontrolled to controlled and emit a warning.
let [placeholderDate, setPlaceholderDate] = useState(
() => createPlaceholderDate(props.placeholderValue, granularity, calendar, defaultTimeZone)
);
// Reset placeholder when calendar changes

@@ -206,10 +219,2 @@ let lastCalendarIdentifier = useRef(calendar.identifier);

let [value, setDate] = useControlledState<DateValue>(
props.value,
props.defaultValue,
props.onChange
);
let calendarValue = useMemo(() => convertValue(value, calendar), [value, calendar]);
// If there is a value prop, and some segments were previously placeholders, mark them all as valid.

@@ -216,0 +221,0 @@ if (value && Object.keys(validSegments).length < Object.keys(allSegments).length) {

@@ -156,3 +156,4 @@ /*

hideTimeZone: props.hideTimeZone,
hourCycle: props.hourCycle
hourCycle: props.hourCycle,
showEra: value.calendar.identifier === 'gregory' && value.era === 'BC'
});

@@ -159,0 +160,0 @@

@@ -210,3 +210,5 @@ /*

hideTimeZone: props.hideTimeZone,
hourCycle: props.hourCycle
hourCycle: props.hourCycle,
showEra: (value.start.calendar.identifier === 'gregory' && value.start.era === 'BC') ||
(value.end.calendar.identifier === 'gregory' && value.end.era === 'BC')
});

@@ -213,0 +215,0 @@

@@ -30,3 +30,4 @@ /*

maxGranularity?: 'year' | 'month' | DatePickerProps<any>['granularity'],
hourCycle?: 12 | 24
hourCycle?: 12 | 24,
showEra?: boolean
}

@@ -80,2 +81,6 @@

if (options.showEra && startIdx === 0) {
opts.era = 'short';
}
return opts;

@@ -82,0 +87,0 @@ }

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc