[英]show certain date in date picker
I'm using pickmeup datePicker in my Angular project, and it works good and stable but I faced a problem. 我在Angular项目中使用pickmeup datePicker ,它工作良好且稳定,但我遇到了问题。 When I'm trying to set a particular date, picker breaks and/or disappears.
当我尝试设置特定日期时,选择器中断和/或消失。 I used the method
set_date
from the documentation but I think I'm missing something. 我使用了文档中的
set_date
方法,但我想我缺少了一些东西。
I use the following code 我使用以下代码
showDate(timestamp: number) {
const timeString = timestamp.toString();
this.pickerInstance.set_date(new Date(timeString));
}
I have a stackblitz code template here . 我这里有一个stackblitz代码模板 。
So the idea is, I want to have a button when I'm pressing on it, it passes timestamp value to showDate
function and after that datePicker shows my date. 所以这个想法是,我想在按下按钮时有一个按钮,它将时间戳记值传递给
showDate
函数,然后在datePicker显示我的日期之后。
I don't want to use jquery here, I believe this could be done without it. 我不想在这里使用jquery,我相信没有它就可以做到。 But maybe I'm wrong.
但是也许我错了。
Any ideas, comments, help is welcome? 有什么想法,意见,帮助吗? thank you.
谢谢。
Date
needs a number not aa string. Date
的构造函数需要一个数字而不是字符串。 this.pickerInstance.update()
after the update this.pickerInstance.update()
public showDate(timestamp: number) {
this.pickerInstance.set_date(new Date(timestamp));
this.pickerInstance.update();
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.