0

I am given a project. My team leader said that I should solve that problem which is that calendar doesnt let us select a day from future, it only lets us choose today. And he said i will do it on Angular 1.

But when I open the project on VS code, I found the calendar part in "src-sass-dashboard-_calendar.scss" All I see there are css codes. I havent worked with angular before, so how can I find where to write angular code, since all I see are only CSS codes there. I dont know if angular is same like css?

Can you give me a tip?

  • 1
    I think it is not related to CSS, we can disable future date in the HTML date input. also, we should bind that max property. – Sanka Sanjeewa Mar 24 '21 at 07:30
  • @sankasanjeewa thanks for answering. Cant it be done without writing max value for the day? And he said i should do this by using angular-1 since it was done by angular -1 few years ago. If it could be done only by Html, why would he ask me to do with angular 1? –  Mar 24 '21 at 07:35
  • 1
    No no, HTML is already in the angular. check this https://stackblitz.com/edit/angular-ivy-x4nsds?file=src%2Fapp%2Fapp.component.html – Sanka Sanjeewa Mar 24 '21 at 07:58
  • Can you please explain more detailed as i am new to this. I just have html, css, and java knowledge. I didnt understand how it works, You mean the maxDate value in app.component.ts is the one which does the work, with app.component html? Btw my question is, the min date on calender must be today, for tomorrow it should be tomorrow. I mean past days shouldnt be selectable but future days should be selectable. And in my files of the project on vs code, i couldnt find any file extension as ".ts" . Do you think it must be somewhere in files? –  Mar 24 '21 at 08:07
  • Yeah... you can't find any ts file, because Angular 1 (AngulaJs) uses java script as the language. I don't have much knowledge about it. You can go through some tutorials to learn it. The "Data binding" part may be helped you to answer your question. – Sanka Sanjeewa Mar 24 '21 at 11:16
  • I was looking at some codes on w3schools, but it didnt help me. There is no any information about calendar, or datePicker. Thanks for answering anyway –  Mar 24 '21 at 12:09

1 Answers1

0

When I run my Vs.code on my command window with the code "gulp serve", it opens on my browser. For example this page's link finishes with how-to-solve-the-calendar-problem-cause-it-doesnt-select-future When I open my program on browser, I copied the last words on my link, and searched it on vs.code And I found the html, and js file. Since it's angular1, it has no .ts file. That time all angular was in js.

I tried to see words related to calendar, or datepicker etc. And I found datepicker-options = "dateOptions"; When I search dateOptions, on my js code I found where it was. And I corrected my calendar, now it works.

The person who did this project before, wrote maxDate as a day in 2020. So it wasnt working anymore. I corrected it as maxDate = new getMaxDate();

and I defined this function under.

function getMaxDate() {
var futureDay = new Date();

futureDay.setDate(futureDay.getDate + 365);

return futureDay;

} now it works perfectly. You can write any number where i wrote 365. Its your preference.