Closed inkCrazy closed 4 months ago
<DatePicker value={this.state.customDate} // defaultValue={dayjs().subtract(2, 'day').toDate()} defaultValue={new Date()} minDate={new Date('2023-01-01')} maxDate={dayjs().subtract(2, 'day').toDate()} //最小是前天 onOk={this.endTimeConfirm} onDismiss={this.endTimeCancel} precision="day" onChange={this.endTimeonChange} format="YYYY-MM-DD"> <List.Item arrow="horizontal"> <View style={styles.datePickerListTitle}> <Text style={styles.importFlag}>*</Text> <Text style={styles.title}>自定义时间</Text> </View> </List.Item> </DatePicker>
9.8.1
iOS, Android
npx react-native info
System: OS: macOS 14.5 CPU: (10) arm64 Apple M2 Pro Memory: 91.73 MB / 16.00 GB Shell: version: "5.9" path: /bin/zsh Binaries: Node: version: 20.0.0 path: /usr/local/bin/node Yarn: version: 1.22.19 path: /opt/homebrew/bin/yarn npm: version: 9.8.1 path: /opt/homebrew/bin/npm Watchman: version: 2024.01.22.00 path: /opt/homebrew/bin/watchman Managers: CocoaPods: version: 1.14.3 path: /Users/inkcrazy/.rvm/gems/ruby-3.0.0/bin/pod SDKs: iOS SDK: Platforms:
No response
没问题了,maxDate限制了defaultValue,没注意,同时设置了value值是undefined或者null,会导致defaultValue失效,然后value就是最小日期
💬 Before You Start
🙋 Description/Step to reproduce
🔴 Version
9.8.1
💻 Environment
iOS, Android
⚫️ Output of
npx react-native info
System: OS: macOS 14.5 CPU: (10) arm64 Apple M2 Pro Memory: 91.73 MB / 16.00 GB Shell: version: "5.9" path: /bin/zsh Binaries: Node: version: 20.0.0 path: /usr/local/bin/node Yarn: version: 1.22.19 path: /opt/homebrew/bin/yarn npm: version: 9.8.1 path: /opt/homebrew/bin/npm Watchman: version: 2024.01.22.00 path: /opt/homebrew/bin/watchman Managers: CocoaPods: version: 1.14.3 path: /Users/inkcrazy/.rvm/gems/ruby-3.0.0/bin/pod SDKs: iOS SDK: Platforms:
Additional comments
No response