I am using the "ListView" view and have not set any options related to minTime or MaxTime. In the array I see the event as
start: 2021-06-21 00:00
end: 2021-06-24 08:00
In the render it ends on June 23rd writing in the first column 00:00 - 08:00 but it should end on June 24th.
If I try to activate the "AgendaWeek" view it draws the event correctly.
This happens with hours less than 09:00. If I put 9 o'clock up it considers me on the right day. Why?
In my opinion in the "ListWeek" view even a single second should end on the correct day, or at least looking at how long the minimum duration slot is set
This option works with v3:
nextDayThreshold: '00:00:00'
Related
Initially, I got the number of week this week of month of 2020 which is week 43 (Oct 19 2020 - Oct 25 2020).
I also have two buttons which serve as next and previous.
When I click next button, the date changes to (Oct 26 2020, Nov 1 2020) as well as the week number to 44.
The same way goes to previous button. All is working almost fine, However, when I reach year 2021, the week number becomes 1 of course. and when I click previous again, it goes to the last week number of year 2021 instead of 2020.
My code for incrementing and decrementing weekly is this:
date.setDate(date.getDate()+7) //increment
date.setDate(date.getDate()-7) //decrement
I know the reason why it does not go back to the last week of 2020 because I only deducted 7 days.
However, I can't figure out how to go back to the last week of 2020 when I click previous.
Any idea?
UPDATE: Just now, I noticed, when I'm on the last week of 2020 and click next, Instead of going to '2021', It jumps to '2022'.. damn, I really hate working with dates on javascript.
I concluded. using native javascript date is such a hassle,
instead, I used momentjs.
all of the long code simplified by using
moment(date).add/subtract(no_of_days, 'd');
It automatically do the thing for you. no need to get the number of week and the year.
I'm using the moment.js library to plot some values on a graph. I have two buttons called Previous and Next that go one month behind and one month forward from the current date respectively.
Now, the issue that I am facing is with the subtract function - for example, since today is February - the endOf('month') function moves up to 28 days. Now, if I wish to move a month back to January, I am using the following :
moment().endOf('month').subtract(1,'month'+ 's');
This does move back to January, but the date endOf date is still 28 - and due to this my graph only plots until this day of January.
Is there a way I can check for the month and set in the correct last date as I move behind or forward using the subtract function? Or am I missing out on something?
Here is a simple fiddle - I'm alerting the value after using the moment functions.
Subtract 1 month before using endOf.
I am currently working on a facility booking system. In the process of booking a facility, users can choose a time slot. When the user picks a date and facility to book, an ajax call is made to retrieve all available time slots. The data returned includes the time slots for weekdays and weekends (yes, they have different time slots).
Weekday and weekend and time slots are placed in a table. There is another function to check whether that the chosen date is a weekday or weekend. If it is the former, the weekend time slots will be hidden. If it is the latter, vice versa.
The opening time for weekdays: 08:00 - 21:00
The opening time for weekends: 08:30 - 17:30
To hide said time slots, the following code is used:
if (lastId != end_time_id) {
for (var i = lastId + 1; i <= end_time_id; i++) {
$('#trTimeslot' + i).hide();
}
}
If the code works perfectly, the time slots will be shown like this:
Chosen Date: 27 June 2017, Tuesday (Weekday)
Chosen Date: 1 July 2017, Saturday (Weekend)
However, at times, the code does NOT work. At times, the time slots shown will show BOTH weekdays and weekends:
Chosen Date: 27 June 2017, Tuesday (Weekday)
It must also be noted that 7 - 8 functions, filled with ajax requests, are called before the time slots are shown. The function to hide the "weekend" or "weekday" rows is the 5th function.
The question is, is there anything I can do to make sure the rows will be hidden before the time slots are shown to the user?
I do apologise that I cannot show more codes as the company is pretty sensitive on these kind of stuff.
Any help or suggestions would be greatly appreciated.
The code to hide is running before the code that populates the time table, add the loop to the callback after the data is inserted to the time table and displayed.
This may not be an absolute answer to the problem , I would rather suggest to do the opposite. From the problem description I assume there is an ajax call which return the data & following which the function triggers to hide the irrelevant rows. A minute delay will be there because of DOM traversal
Alternatively
Initially hide the view (weekends & timeslot).
Check for the condition and show only relevant data.
Till that time there can be a spinner in the screen to show work is in progress
I've came across something that I thought it was right, but now taking a closer look something is clearly wrong.
I'm on a project of a pill reminder app where someone can set notifications to remind him/her of taking pills in the correct time. There're medicines which a person can take for the rest of his life. And in that case I don't set alerts for years, I set for 3 months max and, when he takes one and mark it as done, I set another alert for 3 months later starting on that date/time.
This app will be released only in Brazil and we have Daylight Saving Time here. When it shifts to DST time the clocks must be adjusted to -1 hour after midnight, when going off DST it gains 1 hour.
For this project I'm using Firebase, Ionic 2, the LocalNotification Plugin and Moment JS.
I have to make a story of the user because other user can see if he's taking it correctly, so I use Moment JS to manipulate the datetime and save the notification and create a node for that user in firebase with UNIX time.
LET'S FINALLY GO TO THE PROBLEM.
When saving a date I check if this date is DST, if it is I add +3 hours to it, if it's not I add +2. I need to add this because when I wrap the isoString in the Moment() function it gives me -3 hours or -2 hours (Haven't searched for this, but I think Moment uses USA time).
This works fine if I'm saving dates inside DST times if I'm in DST time, if in some case I'm not on DST and save a notification for a DST time day it saves with +2 hours.
AN EXAMPLE
The DST time will shift to in DST on October 15. If I need to save 30 notifications, one per day everyday as 12AM, starting at October 1 up to October 30. From day 1 to day 15 the dates will be right, from day 16 to 30 they'll be with +2 hours.
Here's the basic code I use:
// THIS'LL SET MY DATEPICKER TO THE DATE/HOUR I'M IN.
minDate: any = Moment().isDST ? Moment().subtract(3, 'h').toDate().toISOString() : Moment().subtract(2, 'h').toDate().toISOString();
// THIS'LL CONVERT THE SELECTED DATE TO A UNIX TIME IN WICH I'LL USE TO SAVE THE NOTIFICATION AND THE MEDICATION DATA ON FIREBASE
unixConverted = Moment(this.minDate).isDST ? Moment(this.minDate).add(3, 'h').unix() : Moment(this.minDate).add(2, 'h').unix();
What is strange is that using Moment().unix() alone it give me the right time I'm in, if I use Moment(this.minDate).unix() it gives me -2 or -3 hours of the hour I selected.
So if it's in DST (in which I've set my clock to -1 hour) I add 3, if not I add 2.
So how is the proper way to manipulate this DST shift?
Is there a better way to do this than using DST?
Am I right using this logic or is this much more complex than what I think?
Ok so i've found a better way without using .isDST() method.
Simple use Moment().add(Moment().utcOffset(), 'm'), this'll get the current moment time and add the offset in minutes.
The .add() and .subract() methods makes Moment return the UTC time.
The utcOffset() returns a positive or negative number of minutes (representing hours) from UTC, like -60 or 180. So i'll get the correct respecting the time shift.
Worked like a charm for me.
If you choose to view a week or day the left column will by default show 6am, 7am and so on. How do i go about to make it show 06:00, 07:00 and so on instead?
Edit: im talking about the left column i weekview and dayview that by default is 6am, 7am, 8am. NOT the timestamp in the events.
To further point out the problem i want to changes the am/pm to 24hour times for the highlighted part of the image: http://bildr.no/view/770893
check this out
http://arshaw.com/fullcalendar/docs/text/timeFormat/
you should always check documentation before anything else just a tip
try this
day: 'h:mm{ - h:mm}', // 5:00 - 6:30
week: 'h:mm{ - h:mm}', // 5:00 - 6:30
or this one might be it
http://arshaw.com/fullcalendar/docs/agenda/axisFormat/
i think it's this one tbh :P
like this
axisFormat: 'h:mm{ - h:mm}',
FOR A 24 HOUR CLOCK U CHANGE THE CONTENT TO
axisFormat: 'H:mm',