Showing 06:00 instead of 6am in FullCalendar - javascript

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',

Related

Jquery FullCalendar ListWeek wrong date

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'

Laravel & Javascript - Converting Time to Todays Date + Time

Im looking for help converting a Time only feild to dateTime so i can calculate "Time Elapsed"
For Sports events, I have a feild for Date & Time for the event/game, a feild for 1st half start time, and 2nd half start time, these last two do not include dates,
Example,
Event Date - Wed Apr 28 2021 21:29:05 GMT+1200
1st Half - 21:17:22
How can i calculate the time elapsed from the current time to the start time of the 1st half?
Thanks in advance

How to convert current time to CET in Angular

I have seen couple of questions on the same, but which I'm facing the issue is not addressed anywhere so that only asking again.
I am trying to convert current time to CET time so initially i had implemented like this
component.ts
public currentDate;
ngOnInit(){
this.currentDate = new Date();
}
component.html
TIME: {{currentDate | date:'h:mm a':'+0100'}}
With above snippet initially it was matching fine with CET time, but now getting one hour difference. And i found in docs like Central European Time CET alternates between UTC+1 (standard time) and UTC+2 (when daylight saving time (DST) is observed).
All countries in the CET time zone observe DST (UTC+2) from 02:00 am on the last Sunday of March until 03:00 am on the last Sunday of October.
So based on this from last Sunday of march to last Sunday of October supposed to add +2hrs..And tried the same and now matching the same with CET.
But how can we handle this dynamically, or any other approach to convert current time to CET, Instead of changing +1hr some time and +2hr some time period.
Thanks in advance.

Exclude weekend dates from working days in JavaScript

So I am kinda stuck in figuring out a certain aspect. What I want to do is the following:
Let's say I just have a simple date display, which will show a date such as October 10th, 2017 to an end user. And then there is an option to subtract a certain number of days from said date (an offset of 1, 2, 3, whatever offset is chosen).
What I am looking to do is completely exclude weekend dates from the count - so if today is Monday, October 9th, and an offset of 1 is selected, it goes to Friday the 6th; if an offset of 2 is chosen, it goes to Thursday the 5th; an offset of 3 goes to Wednesday the 4th...
If today was Wednesday, October 11th, an offset of 2 would take you to Monday the 9th, an offset of 4 would go to Thursday the 5th, and so on (completely disregards / skips weekend dates when counting / subtracting which day to land on).
I have so far been able to only find answers for the functionality to calculate the number of working days excluding weekends, and things of that nature (which I already have, using the momentjs-business npm module, but is not exactly what I need).
I did not post code because this is part of a much larger code base, and I feel posting snippets would only add to the confusion, since I believe the question is relatively simply and straightforward; I do not want to over complicate.
All I would like is to not include weekends at all when setting an offset from whichever date is displayed to the user (the date which is displayed to the user is from a database).
I hope this all made sense, and if more info is needed, please let me know. Thanks in advance for anyone that can point me in the right direction!
This will achieve what you want I think. Please note this is terribly inefficient. If your offset is very large it generates a new date every iteration of the loop. With some tinkering it could be optimized
let startDate = new Date('10/10/2017');
let endDate = "", offset = 2;
while(offset > 0){
endDate = new Date(startDate.setDate(startDate.getDate() - 1));
if(endDate.getDay() !== 0 && endDate.getDay() !== 6){
offset--;
}
}
Here is a working Fiddle
You can use moment-business library. It has the subtractWeekDays that:
Subtract week days from the moment, modifying the original moment. Returns the moment.
Your code could be like the following:
var m = moment("October 10th, 2017", "MMMM Do, YYYY");
business.subtractWeekDays(m, 2);
If you don't want to add an external library, have a look at addWeekDays and subtractWeekDays code.
JavaScript date objects have a getDay() method that tells you what day of the week it is. You could use this to figure out which dates are weekends and exclude them.
var date = new Date();
var dayOfWeek = date.getDay();
console.log(dayOfWeek) // 1 for Monday, 2 for Tuesday, etc.

Set a range in moment.js

I would like to know how to set a day range on moment.js, I just need to show just the weekdays not the weekends.
At the moment I'm using this:
Database: moment().subtract('days', 1).toDate(),
{{Database}}
I use this to show the database refresh but on weekends there are no updates.
Based on your comments, I think that this does what you want:
m.subtract(m.day() === 1 ? 3 : 1, 'days');
If m is a moment, this will subtract 1 day except for on Monday (where m.day() === 1) where it will subtract 3 days. This means that m will go through the days backwards like Wednesday, Tuesday, Monday, Friday, Thursday, etc.
If this is what you want, I am happy to help you modify your question to make it more clear. If not, please edit it to explain what you are trying to do.

Categories

Resources