mehrabisajad / ng2-datepicker-jalali

datepicker jalali for angular 2
MIT License
21 stars 7 forks source link

How to initial datepicker input with today date? #6

Closed hadirsa closed 6 years ago

hadirsa commented 6 years ago

I want to initialize datepickerinput with current date. i use code below but is set it to Gregorian today date.

this.date = {year: now.getFullYear(), month: now.getMonth() + 1, day: now.getDate()};//result 2017/09/29 how can i initialize it to Jalali's today date?

I found getToday() in ngb-calendar-persian.ts but i cant use it.

mehrabisajad commented 6 years ago

You can get the current date like this:

https://github.com/mehrabisajad/ng2-datepicker-jalali-test/blob/master/src/app/app.component.ts#L22L32

hadirsa commented 6 years ago

@mehrabisajad yeah! the link was helpful! thanks.👍