1

I'm using a datepicker inside a modal, but I don't know how to specify a specific date when the modal is opened.

Is there a way to display a specified date when using tui datepicker? Below is the example code

const asDate = new tui.DatePicker('#asDate', {
        language: 'ko',
        type: 'date',
        usageStatistics: false,
        input: {
            element: '#asDate-input',
            format: 'yyyy-MM-dd'
        }
    });
asDate.setDate(new Date()); // today set

//modal open
asDate.setDate('2023-02-20');
var changedate = this.data().visit_date // 2023-02-16T15:52:00

asDate.setDate(new date('2023-02-20'));
asDate.setDate('2023-02-20');
asDate.setDate(changedate);

I've tried several ways but either get an error or make no difference.

const getdate = new Date(this.data().visit_date);
                asDate.setDate(getdate)

I solved it as above.

P.P
  • 11
  • 3

0 Answers0