How to display exact current year in yii2 - javascript

In yii2, how can we display exact current year even if the user has changed the system year.
For eg. if year is 2017 and if we change the year from system to 2018, then how should we display correct year i.e, 2017

If the user cannot choose the year there's simply no point in asking him. If you think that current year is an important piece of info for the user just display a static label generated from server—in PHP that'd be echo date('Y');.
If you feel that having current year changed and not getting it updated real-time in your HTML while the user is filling the survey is not acceptable, you might want to consider making your survey shorter.

Related

unable to display a single year using #nivo/calendar

I'd like to leverage #nivo/calendar to display a year's worth of data (every single day of the year). All my dates are within the valid range. If I set the start date to 2016-01-01 (where YYY-MM-DD), I get two year calendars (2015+2016). Setting it to 2016-01-02 fixes the issue (shows only 2016), but then I missing data for the first day of the year. I have a hunch this is some sort of timezone bug.
Has anyone run into this issue?
from="2016-01-02" // setting from to 2016-01-01 causes bug where two years are shown instead of one
to="2016-12-31"
You can see the issue here:
https://codesandbox.io/s/nivo-calendar-single-year-forked-lemu8i

How to calculate the number of years and the answer is a range of age?

I have a form where someone places their year of birth. I need to get the age range of the person.
Example: For someone born in 1979 the range would be 40-45.
This answer depends on where you want to do this task.
Do you want to show it to the user before or after submitting the form?
Do you want to save it on the backend into a database?
Either way, here's something you can try:
Get the current year
I recommend w3school for things like these: https://www.w3schools.com/js/js_dates.asp
Get the difference between the year the user entered and the current year.
Don't forget error handling
Check the range and display the result
Use a conditional statement (if/else or switch).
This answer is very general because I'm not sure how you would like to implement the method. Hope this provides some hints!

Custom Date and Time Input with date of "Today" adding one day for a Restaurant

I am currently a student and I would like to get some help for a website I am creating.This is what I would like to make it look like.
So what I am trying would be this, today is the 30th Oct. 18, adding 1 Day, like shown on the form and having the current time, which is not the hard part, I am just unsure about the date and I can't find the right solution on the internet.
If anybody could help, that would be great.
Thank you before hand.

Datepicker custom selection Javascript / jQuery

I need to make the datepicker like this:
just a brief intro, my project is to make something like employee holiday request.
so that the employee can apply their day-off request, but here's what my boss ask for the requirement. Sunday, and world official holiday need to be automatically added when the user picked the previous date or after.
Ex : 25 December is Christmas day.
Then I (as the employee) lets say pick 24th Dec and 26th Dec as my day-off. Then I may not skipped 25th December, it needs to be calculated as well.
That means I already used my 3 days off chance(my office only allow 12 days day-off in a year).
Sorry for the long explanation, I'm a newbie. I just want to know is this possible and if so, how? can you at least show me the trick. THANK YOU SO SO MUCH

Is there a Javascript date picker that allows me to select multiple dates based on a weekday?

I would like to able to select all Wednesdays in a given month by clicking on the day in the calendar UI. For example to schedule a meeting that occurs on every Wednesday. I would like the user to be able to just click on a day name rather than clicking every specific date.
I was wondering if anyone is aware of a Javascript date picker library that already has this feature or is this something I will have to write myself?
I've looked at a few multidate pickers available out there (http://multidatespickr.sourceforge.net/ for example) and they all have a feature to select a RANGE or the entire week however it seems that none of them support selection based on a specific week day.

Categories