javascript - Ant Design: defaultValue of <DatePicker> component is not working as expected - Stack Overflow
I am creating a detail page where I want to display an editable deadline and for that, I am using <DatePicker>
ponent of Ant Design
. The problem is when I set defaultValue={moment(deadline)}
it's not showing the date deadline
variable is holding but instead, it is showing the current date.
<DatePicker
showTime
format="YYYY-MM-DD HH:mm:ss"
placeholder="Set Deadline"
defaultValue={moment(deadline)} //moment(deadline) returns valid moment date objcect
onOk={(value, dateString) => {
newDeadline = value._d;
updateDeadline(newDeadline);
}}
/>
I don't know where I am doing wrong please help me to find it out...
UPDATE
When I console the value of deadline
, typeof deadline
, moment(deadline).toString()
all are returning data as expected.
When I use value={moment(deadline)}
instead of defaultValue={moment(deadline)}
, It's also working fine.
One interesting thing, when I pass date string instead of deadline
variable to defaultValue
, It's working smoothly.
- VMware宣布与Yahoo收购电子邮件和协作软件提供商Zimbra的协议
- .NET开源:微软"云为先"战略的全面铺开
- Windows 8—微软反击苹果的终极武器
- 鲍尔默安抚硬件伙伴:Surface只是一个参考设计
- 成本高、厂商疑 微软Surface面临十大风险
- Windows8是备胎?解析微软移动市场战略
- 英特尔公布搭载其芯片的Windows 8平板电脑的硬件配置规范
- javascript - Why does the letter animation work outside a <button> but not inside it? - Stack Overflow
- react native - Handling loginlogout without user undefined errors - Stack Overflow
- node.js - Parsing error when sending data from godot to api - Stack Overflow
- sqlite - invalid call to function 'connect' in base 'NAtiveScript'. expected 3 arguments in godo
- vuejs3 - Vue 3 Composition API data() - Generic idea required - Stack Overflow
- c++ - Camera is tilting when trying to rotate quaternion - Stack Overflow
- flash - Movie clip loading display problem in ActionScript 2 - Stack Overflow
- google cloud platform - Java application unable to find ADC when Workload Identity is enabled on GKE cluster - Stack Overflow
- ace - Does JSONEditor have a default function to get the JSON block from the cursor position? - Stack Overflow
- How to debug Quarkus producer method - Stack Overflow