Does mobiscroll have a method to get the day of week in given language (set from 'lang' option). I could not find in the docs.
Bellow is a snippet code what I want to achieve.
$('#mobiscroll').mobiscroll().calendar({
onSet: function (event, inst) {
var DayOfWeek = event. // ex: Saturday
var Day = event. // ex: 20
var Year = event. // ex: 2020
}
});
You could get it from the dayNames array, but I'm not sure how does that help you?
Related
I have date-picker component (DayPickerSingleDateController).
There is "
isoutsiderange
property (available only +4 (from to day) days. )
But because of this an error occurs. Event if current month don't have available dates it still shows current month onClick.
Now i trying to add initialMonth property in which I would like to check if there are not dates available in this month, then () => moment().add(1, 'month').
initialVisibleMonth={.... () => moment().add(1, 'month')}
isOutsideRange={(day) => isInclusivelyBeforeDay(day, moment().add(4, 'days'))}
How can i do that?
I got the following solution for my problem.
I declared the isAvailableDaysInCurrentMonth variable like this.
const firstAvailableDay = moment().add(3, 'days') // in my situation, i need "not earlier then 3 days"
const isCurrentMonthExcludeAvailableDate = (moment().month() !== firstAvailableDay.month());
Now i can set initial month in singleDatePicker.
So if there are not available dates in current month, then set next month for show.
<DayPickerSingleDateController
...
initialVisibleMonth={isCurrentMonthExcludeAvailableDate ? () => moment().add(1, 'month') : null}
>
I found this answer myself, maybe there is a more elegant solution, but still it may be useful for someone.
I have tried to implement the recurring frequency on Angular UI-calendar but still didn't get any angular plugin.I need help in creating recurring event.If you can please give any reference plugin or directive to create recurring event.
I got Ui-calendar from here calendar downloaded link
Thanks in advance !!
I leveraged the fact that, on a view switch of the calendar, the Arshaw calendar can employ an events functions (http://fullcalendar.io/docs/event_data/events_function/).
First assemble the array of repeating events in your service into an 7-slot array of arrays, one slot for each day of the week. Put this on the scope. Then when you open up or switch the calendar view, iterate from the start day to the end day of the function, and insert an event that matches your recurrence type.
function eventFunction(start, end, timezone, callback) {
var events = [];
for(var date = start; date <= end; date.setTime( date.getTime() + MS_PER_DAY )){
_.forEach($scope.calendar.repeating[date.getDay()], function(repeater){
var repeaterStart = date.getTime() + // date
repeater.start - new Date(repeater.start).setHours(0,0,0,0); // time
events.push({ _id: repeater.id, start: new Date(repeaterStart), title: repeater.headline})
})
}
callback(events);
}
I just started with AngularJS and got stuck with a problem.
I have a date field to show in a grid.
Date format should be relative format like "1 day ago, 10 mins ago...."
So for that i used timeAgo, so it formats the date correctly.
But I have a requirement like:
If the last_updated_time is less than 10 days, then show relative time like "1 day ago, 10 mins ago...." else do not apply any filter.
Here is my code snippet.
<td data-title="'Last modified'" sortable="'last_updated_time'" align='center'>
{{offer.last_updated_time | timeAgo }}
</td>
It would be great if someone can guide me how to proceed.
Use a function to get this:
$scope.getTimeAgo = function(last_updated_time ){
var today = new Date();
var days = today.diff(last_updated_time , 'days');
if(days > 10)
return last_updated_time;
else
return moment(last_updated_time).fromNow();
};
then you can use it like follow:
{{getTimeAgo(offer.last_updated_time)}}
PS: I'm using momentjs for time ago but you can apply your time ago function into the else if you want to use your filter.
I need to do Validation for both Start Time And End Time, if start time is greater then end Time Throw and error.
How Can i achieve this.
Which Events do i need to use to get the validation done onselect, onclose??
Please Help me out
Thanks
You can do this using onSelect event making changes to the mobiscroll.
Here is an example i tried.. you might find useful
onSelect: function (dateText, inst) {
var newMinDate, newMaxDate;
endDate = new Date(dateText);
var newEndDate = new Date(endDate.getFullYear(), endDate.getMonth(), endDate.getDate() + 5);
$endCal.mobiscroll('setDate', newEndDate);
newMinDate = new Date(endDate.getFullYear(), endDate.getMonth(), endDate.getDate() + 1),
$endCal.mobiscroll('option', {
minDate: newMinDate
});
}
https://jsfiddle.net/sarvesh310/742Lqagk/2/
You can dynamically set the minDate and maxDate options in the onSelect event, e.g.:
$('#end_time').scroller('option', 'minDate', $('#start_time').scroller('getDate'));
A working example (does not allow to select a start date > end date):
http://jsfiddle.net/dioslaska/2MVv6/1/
This works with date and datetimepickers as well.
I've added the calendar from http://www.dynarch.com/projects/calendar/old/ onto my wordpress site. It loads fine but I don't want people to select dates in the past which I've managed to do but want to add a strikethrough but don't know how. Please help.
Thanks
http://www.dynarch.com/static/jscalendar-1.0/doc/html/reference.html#node_sec_5.3.7
You need your own disabled date handler
For example
function disallowDate(date) {
// date is a JS Date object
var d=new Date();
if ( date.getTime() < d.getTime()) {
return true; // disable anything less than today
}
return false; // enable other dates
};
calendar.setDisabledHandler(disallowDate);