React big calendar receives an array with objects:
allDay: true
end: Sat Jan 13 2018 03:03:00 GMT+0200 (EET) {}
eventType: "video"
start: Sat Jan 13 2018 03:03:00 GMT+0200 (EET) {}
title: "0"
There can be 3 types of EventType - video, duration and audio,
but they are displaying completely in random order.
Image
Need an advice how to set an order?
Related
Introduction
I have the current situation:
I receive the date from the backend as UTC
The user can have in his own profile his timezone setup
User can pick the date and time in two different time pickers
As soon as the date is returned by the backend I convert it to the user local timezone (timezone of his profile)
User selects new date, I create a zonedDate, modify it and store it as UTC
User selects new time, I use the utcToZonedTime to convert to user's local timezone (the UTC returned from backend), then I update with setHours and setMinutes and store back as UTC using toISOString() string
How the code is structured
I currently have the following code for when the user pick the date
import utcToZonedTime from 'date-fns-tz/utcToZonedTime';
const localizedTime = computed(() =>
utcToZonedTime(record.value.date, loggedUser.timezone)
);
const date = computed({
get: () => formatToDate(localizedTime.value),
set: (value: string) => {
// The `value` will come as YYYY-MM-DD from the DatePicker component
const zonedDateString = `${value}T17:30`;
const zonedDate = toDate(zonedDateString, {
timeZone: loggedUser.timezone,
});
record.value.date = zonedDate.toISOString();
},
});
This works fine for now. I set the hour and minutes to a hardcoded 17:30.
Now, the problem happens whenever picks the time:
import utcToZonedTime from 'date-fns-tz/utcToZonedTime';
import setMinutes from 'date-fns/setMinutes';
import setHours from 'date-fns/setHours';
const localizedTime = computed(() =>
utcToZonedTime(record.value.date, loggedUser.timezone)
);
const time = computed({
get: () => format(localizedTime.value, 'HH:mm'),
set: (time: string) => {
// Time is returned as HH:mm from the input
const [hour, minutes] = time.split(':');
console.log('Localized time:')
console.log(localizedTime.value);
let currentDateParsed = setHours(
localizedTime.value,
hour as unknown as number
);
currentDateParsed = setMinutes(
currentDateParsed,
minutes as unknown as number
);
console.log('Current date parsed:')
console.log(currentDateParsed);
record.value.date = currentDateParsed.toISOString();
},
});
Problem
As a setup I have the following criterias:
User timezone is set to Europe/Lisbon (GMT+1)
My computer timezone is set to Europe/Zagreb (GMT+2)
I receive the following date from backend in UTC 2022-06-02T16:00:56.000000Z
Time is displayed as 17:00 (I'm using the user profile's timezone and not the computer's timezone)
Whenever I set the date, it works perfect time. Whenever I try to set hours and minutes, the timezones get mixed up.
I select the time as 18:30 and it is displayed back to the user as 17:30.
The part of the code that is giving me problems is:
const time = computed({
get: () => format(localizedTime.value, 'HH:mm'),
set: (time: string) => {
// Time is returned as HH:mm from the input
const [hour, minutes] = time.split(':');
console.log('Localized time:')
console.log(localizedTime.value); 👈 // Thu Jun 02 2022 17:00:56 GMT+0200 (Central European Summer Time)
let currentDateParsed = setHours(
localizedTime.value,
hour as unknown as number
);
currentDateParsed = setMinutes(
currentDateParsed,
minutes as unknown as number
);
console.log('Current date parsed:')
console.log(currentDateParsed); 👈 // Thu Jun 02 2022 18:30:56 GMT+0200 (Central European Summer Time)
console.log('Current date parsed toISOString():');
console.log(currentDateParsed.toISOString()); 👈 // 2022-06-02T16:00:56.000Z
record.value.date = currentDateParsed.toISOString();
},
});
I have tried converting the date back to UTC and work only in UTC and also only in user's local time but nothing seems to work. I have uploaded the following video showing the issue
I'm using agora composition recording and want to retrieve the start timestamp to build Synchronous playback.
The document says You can find the start timestamp at the start of each M3U8 file, however my M3U8 file does not contain any timestamp.
I can convert the output files (ts and m3u8) to mp4 by ffmpeg as expected.
The request body for start api is below;
const url = `${agoraApi}/v1/apps/${appId}/cloud_recording/resourceid/${resourceId}/mode/mix/start`
const body = {
cname,
uid,
clientRequest: {
token,
storageConfig: {
vendor: 1, // Amazon S3,
region: 10, // AP_NORTHEAST_1
accessKey: process.env.AWS_ACCESS_KEY_ID,
secretKey: process.env.AWS_SECRET_ACCESS_KEY,
bucket: process.env.AWS_S3_BUCKET,
fileNamePrefix: ["records"],
},
recordingConfig: {
channelType: 1, // default. 0: Communication profile, 1: Live broadcast profile
// maxIdleTime: 30, // seconds (default)
transcodingConfig: {
width: 640, // default
height: 360, // default
fps: 15, // default
bitrate: 600,
mixedVideoLayout: 0, // default
},
},
},
};
The output M3U8 file
#EXTM3U
#EXT-X-VERSION:3
#EXT-X-MEDIA-SEQUENCE:0
#EXT-X-ALLOW-CACHE:YES
#EXT-X-TARGETDURATION:18
#EXTINF:16.038000
8893be119d40bbc66f7ef9a26a676a12_live-aea67a87-f821-4234-894b-1512fcdae181_20210603064340040.ts
#EXTINF:15.972000
8893be119d40bbc66f7ef9a26a676a12_live-aea67a87-f821-4234-894b-1512fcdae181_20210603064357105.ts
#EXTINF:16.038000
8893be119d40bbc66f7ef9a26a676a12_live-aea67a87-f821-4234-894b-1512fcdae181_20210603064413077.ts
#EXTINF:15.971000
8893be119d40bbc66f7ef9a26a676a12_live-aea67a87-f821-4234-894b-1512fcdae181_20210603064429115.ts
#EXTINF:16.039000
8893be119d40bbc66f7ef9a26a676a12_live-aea67a87-f821-4234-894b-1512fcdae181_20210603064445086.ts
#EXTINF:15.972000
8893be119d40bbc66f7ef9a26a676a12_live-aea67a87-f821-4234-894b-1512fcdae181_20210603064501125.ts
#EXTINF:15.972000
8893be119d40bbc66f7ef9a26a676a12_live-aea67a87-f821-4234-894b-1512fcdae181_20210603064517097.ts
#EXTINF:16.038000
8893be119d40bbc66f7ef9a26a676a12_live-aea67a87-f821-4234-894b-1512fcdae181_20210603064533069.ts
#EXTINF:15.972000
8893be119d40bbc66f7ef9a26a676a12_live-aea67a87-f821-4234-894b-1512fcdae181_20210603064549107.ts
#EXTINF:16.038000
8893be119d40bbc66f7ef9a26a676a12_live-aea67a87-f821-4234-894b-1512fcdae181_20210603064605079.ts
#EXTINF:15.972000
8893be119d40bbc66f7ef9a26a676a12_live-aea67a87-f821-4234-894b-1512fcdae181_20210603064621117.ts
#EXTINF:16.038000
8893be119d40bbc66f7ef9a26a676a12_live-aea67a87-f821-4234-894b-1512fcdae181_20210603064637088.ts
#EXTINF:11.679000
8893be119d40bbc66f7ef9a26a676a12_live-aea67a87-f821-4234-894b-1512fcdae181_20210603064653127.ts
#EXT-X-ENDLIST
Am i missing some configuration?
While you are correct to point out that there is no Epoch/Unix timestamp, there is a "timestamp" included the name of each segment. If you notice at the end of the name of the segments, is a human readable date and time.
for example, the first .ts file is named:
8893be119d40bbc66f7ef9a26a676a12_live-aea67a87-f821-4234-894b-1512fcdae181_20210603064340040.ts
If you split the name using the _ as the delimiter, the last element of the array is your timestamp. using the above name for example, the time-stamp would be 20210603064340040.
Taking this further you can break this down as:
yyyy mm dd hh mm ss ms
------------------------
2021 06 03 06 43 40 040
Using the next three files in the list we can see
8893be119d40bbc66f7ef9a26a676a12_live-aea67a87-f821-4234-894b-1512fcdae181_20210603064357105.ts
8893be119d40bbc66f7ef9a26a676a12_live-aea67a87-f821-4234-894b-1512fcdae181_20210603064413077.ts
8893be119d40bbc66f7ef9a26a676a12_live-aea67a87-f821-4234-894b-1512fcdae181_20210603064429115.ts
yyyy mm dd hh mm ss ms
------------------------
2021 06 03 06 43 57 105
2021 06 03 06 44 13 077
2021 06 03 06 44 29 115
The challenge is: how can I set up the start date for notification in the new expo API. In the old API (which is depricated today) it was feasible but I can't see the solution in the new doc
For example: set up a notification on every 2nd day start from a user given date (e.g. 12th of Jan).
I went through on these types
export type SchedulableNotificationTriggerInput =
| DateTriggerInput
| TimeIntervalTriggerInput
| DailyTriggerInput
| WeeklyTriggerInput
| CalendarTriggerInput;
but no success so far.
As far as I can tell you should be able to set the start date this way:
const dateString = "21/01/2021"; // Jan 21
const trigger = new Date(dateString);
trigger.setMinutes(0);
trigger.setSeconds(0);
Notifications.scheduleNotificationAsync({
content: {
title: 'Happy new hour!',
},
trigger,
});
You should play around with trigger.setMinutes and trigger.setSeconds to set a specific hour on your specific day.
There are 10 scheduler of this type in same Class file:
#Startup
#Singleton
#AccessTimeout(value = 1, unit = TimeUnit.HOURS)
public class MeowPoller {
#Schedule(hour = "02", minute = "00", persistent = false)
public void runFetchApplications() {
When some job stuck for say 3 hours then next job does not execute till this job finish.
System keeps on giving:
2020-01-20 01:02:00,001 WARN [org.jboss.as.ejb3.timer] (EJB default - 6) WFLYEJB0043: A previous execution of
timer [id=459875b7-5346-40c1-a9a0-f36dec8ef53d timedObjectId=Meow-1.6-SNAPSHOT.Meow-1.6-SNAPSHOT.MeowPoller
auto-timer?:true persistent?:false timerService=org.jboss.as.ejb3.timerservice.TimerServiceImpl#7ffe6c6a
initialExpiration=null intervalDuration(in milli sec)=0 nextExpiration=Mon Jan 20 01:02:00 CET 2020 timerState=IN_TIMEOUT
info=null] is still in progress, skipping this overlapping scheduled execution at: Mon Jan 20 01:02:00 CET 2020.
Hello I have a question concerning data processing in groovy.
I have a groovy step in which I call a method that gives me a list of json in return, then I parse it to test a value
here is the code :
props = get_device_properties(device_id)
log.info "props = $props"
log.info "size " + props.size()
log.info "class " + props.class
//props = jsonSlurper.parseText(props)
log.info "***************************** t1"
props.find(){
log.info it.name
// check the field songTitle
if (it.name == "songTitle")
{
// first check media
if(init_correct == false)
{
log.info "init = " + it.value
if (it.value == "UNKNOWN")
found == true
log.info "***************************** t2"
here is a log of the process :
Tue Jan 28 11:34:56 CET 2020: INFO: props = [[satisfied:true, href:...
Tue Jan 28 11:35:03 CET 2020: INFO: size 31
Tue Jan 28 11:35:03 CET 2020: INFO: class class java.util.ArrayList
Tue Jan 28 11:35:03 CET 2020: INFO: ***************************** t1
Tue Jan 28 11:35:03 CET 2020: INFO: songTitle
Tue Jan 28 11:35:03 CET 2020: INFO: init = Sad But True
Tue Jan 28 11:35:03 CET 2020: INFO: ***************************** t2
If I parse the map directly there is a gap of time between method return and start of the next processing :
t2 - t1 is around 7s
If 'get_device_properties' returns a String instead of the arrayList and I do a parseText (uncomment the 5th line) on this string, I don't have the extra processing time before I can parse the map
Tue Jan 28 11:35:39 CET 2020: INFO: props = [{"satisfied":true,"href":...
Tue Jan 28 11:35:39 CET 2020: INFO: size 25138
Tue Jan 28 11:35:39 CET 2020: INFO: class class java.lang.String
Tue Jan 28 11:35:39 CET 2020: INFO: ***************************** t1
Tue Jan 28 11:35:39 CET 2020: INFO: songTitle
Tue Jan 28 11:35:39 CET 2020: INFO: init = Sad But True
Tue Jan 28 11:35:39 CET 2020: INFO: ***************************** t2
t2 - t1 = 0
can anyone help me to understand why this happens ?
indeed, I usually tend to use the most straightforward way to implement my script ...