Disable only 2 weeks from today in Datepicker 1.6.4? - datepicker

I am setting up specific Datepicker where only and always next 14 days from today should be disabled.
I have tried beforeShowDay but it's not working for this.
I have also tried using maxDate, minDate, startDate but in this case, it is not working as all dates in past and in future should be able to be selected excluding weekends and 14 days from today.
This is my code for now.
<script type="text/javascript">
$('.datetime').datepicker({
weekStart: 1,
clearBtn: true,
daysOfWeekDisabled: "0,6",
daysOfWeekHighlighted: "1,5",
todayHighlight: true
//format: 'mm/dd/yyyy'
});
</script>
Datepicker Image (assuming today is 16th of April, days in red (always days from today) should be disabled

Related

vuetify v-date-picker not start by first day of month in persian locale

Consider the following code
<v-date-picker
v-model="picker"
:first-day-of-week="6"
locale="fa"
></v-date-picker>
<v-date-picker
v-model="picker"
></v-date-picker>
As you can see in the following picture, In Persian calendar month starts by 12th which is the first day of May
Code Output, Left side is Persian calendar
I also have this problem, unfortunately it's an open bug in Vuetify:
[Bug Report] Problem with vuetify Persian datepicker year selection #11578
Which is a duplicate of:
[Bug] Date picker new month is started at the end of previous month in 'FA-local'.
Personally, I had to user vue-persian-datetime-picker. It's pretty good, a simple api and easily customizable. Still, I hope they fix the problem with v-date-picker

Set datepicker for one year from today in Cypress test

I am creating an acceptance test in Cypress that will run regularly, and I need that it enters the date from the datepicker (React, if it is important) as 1 year 1 month and 1 day from the day of creating the object (article). E.g. Today is April 22, 2020, and I want to get May 23, 2021 in the article created today, and tomorrow it would give the value of May 24, 2021 etc. Could anyone share any ideas of setting this up? I honestly googled and I have no ideas myself because I'm quite new to Cypress and feel more or less confident only in pretty straightforward things. :)
I'd guess that most date pickers will have an input element where the date can be typed.
Presuming the app uses a library date picker (so you don't need to test the picking of the date via button clicks), you can target that element and use the Cypress .type() command to enter the future date.
For example, the Material UI date picker docs has this input element
<input aria-invalid="false"
id="date-picker-inline"
type="text"
class="MuiInputBase-input MuiInput-input MuiInputBase-inputAdornedEnd"
value="08/18/2014">
so the steps would be something like
cy.visit('https://material-ui.com/components/pickers');
const targetDate = Cypress.moment()
.add(1, 'year')
.add(1, 'month')
.add(1, 'day')
.format('MM/DD/YYYY') // adjust format to suit the apps requirements
cy.get('input[id="date-picker-inline"]')
.clear()
.type(`${targetDate}{enter}`) // presume you need the enter key to trigger an event
Ref: Cypress.moment
This method was deprecated. You can use this method;
//click the date picker
cy.get('#datepicker').click();
//choose previous month
cy.contains('Prev').click();
//choose next month
cy.contains('Next').click();
//choose date 24
cy.contains('24').click();

Liferay date-input displays wrong date

I'm using Liferay 7.1 I have the following liferau-ui:input-date object and I want to pre-select a date:
<%
final LocalDate today = LocalDate.now(ZoneId.systemDefault());
%>
<liferay-ui:input-date
dayValue="<%= today.getDayOfMonth()%>"
monthValue="<%=today.getMonth().getValue()%>"
yearValue="<%= today.getYear()%>"
</liferay-ui:input-date>
When I output today's values directly on the JSP I get the correct date for today: 3 12 2018.
When the element is rendered, it has selected the wrong date: 01/03/2019. There is nothing further documented in the taglibdocs that I think could help.
How can I fix this?
The problem is the month value. In Java it's 1-12 with liferay datepicker it's 0-11.
In order to display the correct month i subtracted 1 from month value. It's not an elegant solution but i couldn't find any better way.
<liferay-ui:input-date
dayValue="<%= today.getDayOfMonth()%>"
monthValue="<%=today.getMonth().getValue() - 1 %>"
yearValue="<%= today.getYear()%>"
</liferay-ui:input-date>
This will render 12/03/2018

Ionic 2 DatePicker Customize

Is it possible to customize standard ionic 2 datepicker to display day also, meaning when user selects date, month , year, it would be nice to see what day they are choosing.
Reference:
http://blog.ionic.io/ionic-2-fixing-date-inputs-for-the-mobile-web/
I don't understand exactly your question, but you can display more than 3 elements in a Ionic DateTime. This is just as easy as modify the pickerFormat component parameter. For example this code shows four elements to pick: hours, days, months and year.
<ion-datetime
pickerFormat="mm DD MMM YYYY"
...
>
</ion-datetime>
In the following link you will see all possible formats an options to set into the pickerFormat Input.
DateTime
I hope this can help.
If you want to display the short name of day in the datepicker you should use:
<ion-datetime
pickerFormat="mm DDD MMM YYYY"
...
>
</ion-datetime>

Formatting new Date() into relative time that auto-updates regularly in angular-meteor

I have a variable like this
var time = new Date();
How do I format it in angular-meteor into a relative time like one that shows up in facebook , twitter and other social apps like this "3 hrs ago", "1 month ago" and so on .
One option would be to use the Moment.js fromNow() function, which will display the relative time.
For example:
var time = new Date();
$('#timeFromNow').append(moment(time).fromNow());
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<script src="http://momentjs.com/downloads/moment-with-locales.js"></script>
<div id="timeFromNow">Time from now: </div>
Please note that there is an official Moment.js Meteor package on Atmosphere. If you want to install it, just run the following command:
meteor add momentjs:moment