See minutes view in FullCalendar - fullcalendar

The day grid view shows the day by hours (1-23). How can I show it by minutes (ex: 1:00, 1:10, 1:20, etc...) instead of showing by hours (1, 2, 3, etc...).
Thanks in Advance. The full calendar version is FullCalendar v3.6.2.

slotDuration: '00:05:00', //time slot. Jumps between 5 and 5 minutes
slotLabelInterval: 5,
slotLabelFormat: 'H(:mm)',

Related

how can we define start date value in airflow for weekly or bi-weekly or monthly

We are working on airflow currently. If we have any daily dags which has to run as we follow current date minus 1
if the dag(daily dag 00 10 * * *) should have first run on 20 March 2022 then we provide start date as
'start_date': datetime(2022, 3, 19)
if we have to run on weekly basis or monthly basis, can any pls suggest how to provide start date ?
If the dag should run first on 19th march 2022(every saturday) cron
expression : 00 10 * * 6
what can i provide the start date in this case ? please suggest
is that something like 'start_date':
datetime(2022, 3, 12) or
'start_date': datetime(2022, 3, 11) ?????
is there any way i can get start date based on frequency with some python code ?

Create time index R

I am seeking a way create a time index for dates that can be easily manipulated and changed. Namely to turn the data below into buckets for every 3 days(or 4, 5 , etc.
SO that in below example
8/1, 8/2 , 8/3 = time index(1)
8/4, 8/5, 8/6 = time index(2)
8/7,8/8,8/9 = time index(3)
etc
Appreciate any help from the best community :)
Thank you :)

Swift 3 Error in time interval between two dates

I am trying to determine the interval between two dates that I create using DateComponents. If I make the first date 1 year prior to the second, I get 365 days, 0 hours, 0 minutes and 0 seconds. If I make the dates further apart (400 years here), suddenly my date is off by 11 minutes 56 seconds. Here is the code:
import Foundation
var mycal = Calendar(identifier: .iso8601)
var datum = DateComponents(year:1600, month:1, day:1, hour:12, minute:0,
second:0)
let j2000 = DateComponents(year:2000, month:1, day:1, hour:12, minute:0,
second:0)
let datum_date = mycal.date(from: datum)
let j2000_date = mycal.date(from: j2000)
let interval = mycal.dateComponents([.day, .hour, .minute, .second], from:j2000_date!, to:datum_date!)
print("Datum: \(datum_date!)") //1600-01-01 19:48:04 +0000
print("j2000: \(j2000_date!)") //2000-01-01 20:00:00 +0000
Note the next-to-last line: Comments show what the print produces. I've tried it with the Gregorian calendar too, same problem. I'm not sure exactly how far back the inconsistency occurs, I've gone back far enough to produce and it sometimes seems to "stick" as I change the code moving closer in time again. Strangely, the "interval" appears to show the correct amount of days(here -146097), but the date shown is incorrect and I will likely need that in my calculations. Anyone have any ideas?
The difference could be related to leep year adjustments but that would give a difference of 11 minutes and 14 seconds (there'd still be 40 seconds unaccounted for, 26 of which could be leep seconds).
see: https://www.infoplease.com/leap-year-101-next-when-list-days-calendar-years-calculation-last-rules
In Theory, if you compute a multi-year time difference with a precision of minutes and seconds, you should get variations of 5 hours 48 minutes and 46 seconds every 3 out of four years and get within 11 minutes and 14 seconds on the fourth year. I don't know how macOS (Unix) deals with that there there is probably a bunch of considerations that they need to take into account (especially beyond 400 year where that 11 minutes 14 seconds gets adjusted).
If that level of precision is required by your use case, I would suggest reading up on the minute details of time calculations. Given that dates are stored internally as a number of seconds, going back to a precise day and time over these long periods must require some special math acrobatics.
See Apple's documentation here: https://developer.apple.com/reference/foundation/nscalendar

How to display monthly data in Highcharts graph?

Looks like a dumb question. And probably is. But I don't really get it.
I have monthly data over a ~30-year-period. I am neither sure how to format the data, nor am I sure how to format the Highcharts graph.
What is the correct way of data formatting? Like a "running month", from 1 to 433 (and more):
Date,Value
1,338.45
2,339.15
3,339.47
or in Date.UTC format:
Date,Value
Date.UTC(1980,1,1),338.45
Date.UTC(1980,2,1),339.15
Date.UTC(1980,3,1),339.47
I've done something similar like this, but don't think this is a good style:
Date,Value
1 Jan 1993,
2 Jan 1993,
3 Jan 1993,
4 Jan 1993,
5 Jan 1993,-4.19413878126
6 Jan 1993,
7 Jan 1993,
For the xAxis definition I've see different parameters being used. But as this depends on the data format, not quite sure what to put there:
xAxis: {
type:"datetime",
min: Date.UTC(1980, 1, 1),
...
Thanks a lot for any hints in which direction I should go.
A piece of advice, as you asked:
Date.UTC(1980,1,1) - this is JavaScript function, to return timestamp. For example Date.UTC(1980,1,1) -> 318211200000. I suggest to use timestamp already in your data incoming for a chart. Note: Months in JS starts at 0 (0-> Jan, 1->Feb etc.).
min: Date.UTC(1980, 1, 1) -> this is not necessary, Highcharts lib is smart enough to calculate extremes on the xAxis, you don't have to set it, unless you want to display only part of the data on the chart.
And for example, I would use that format:
Date,Value
318211200000,338.45
320716800000,339.15
323395200000,339.47
Note that all formats are fine - I just suggest to use the easiest one ;)
to set up teh xAxis as a time period you have these options:
1. using Date.UTC(Year, Month, Day):
data: [
[Date.UTC(2016, 0, 5), 4],
[Date.UTC(2016, 1, 6), 6],
[Date.UTC(2016, 1, 7), 9],
check example
using Dates written as numbers, specifies the number of milliseconds since January 1, 1970, 00:00:00.
var xArr = [1455661712000,
1455661791000,
1455661869000,
1455661947000,
];
Check example
I hope these help, otherwise feel free to ask for more details.

Making DateTimeAxis with weekly labels set ticks on an arbitrary day of the week

I'm using a CartesianChart with a DateTimeAxis to display weekly data in a Flex application. When I set dataUnits="weeks" and labelUnits="weeks" on the DateTimeAxis, it automatically places each major tick on a Sunday. However, I would like to provide users with the option of beginning the week on a Sunday or a Monday. How can I ask the DateTimeAxis to instead place the major ticks on a Monday (or some other day of week)?
For example, if the user is looking at total sum of something over the week, and requests that weeks start on a Sunday, the Series data would look like:
x: Date(July 11, 2010) y: 25
x: Date(July 18, 2010) y: 30
x: Date(July 25, 2010) y: 32
etc.
If the weeks start on a Monday, the Series data would instead look like:
x: Date(July 12, 2010) y: 22
x: Date(July 19, 2010) y: 33
x: Date(July 26, 2010) y: 29
etc.
With the second data set, the major ticks are still on July 11, July 18, July 25, etc. but the bars are slightly shifted off-center from the major ticks.
Thanks!
I looked at the code of DateTimeAxis class and I'm almost sure you can't do what you want. If "alignLabelsToUnits" property is set to true (default) then labels are created by rounding Series data dates to appropriate units. In your case (weeks) it looks like this:
case "weeks":
d[hoursP] = 0;
d[minutesP] = 0;
d[secondsP] = 0;
d[millisecondsP] = 0;
if (d[dayP] != 0)
d[dateP] = d[dateP] + (7 - d[dayP]);
break;
So as you can see, it checks if processed date is first day of the week (hard-coded 0), and if it is not, it's changed to be such.
To achieve the behavior you seek, you'd probably have to override function for label creation and write another one for date rounding, as the default rounding function is declared private.
Even though you specify weeks, DateTimeAxis may still be using the hours and minutes values of the newly created date objects. You can format the date to set these to zero. Have a look at http://www.munkiihouse.com/?p=69, mention setting displayLocalTime=”true” in DateTimeAxis tag. Let us know if it works man

Resources