Custom sorter for two values on same column - javascript

I have a column in sapui5 table where I am using two values to be displayed in an HBox; "date" and "time". Moreover, in leading property field, I have defined "date" field.
I have a personalization box for this table, where it provides sorting functionality based on "date" field (since "date" is defined in leading property, and one can only have single leading property for a column).
Date sorting-> works fine and as expected.
Issue is, for same dates, I cannot sort further based on time. So in the picture below, I should get 22:01 first, and then other 22:56 data. This is not happening.
I want to know if there is any way I can implement more than one condition in p13n sorting? If yes, how? I tried to find also some CDS annotations which can be used but found none.
Thanks in advance.

I found the issue. Actually, SAP backend has two date formats for 12'o clock; 00:00 & 24:00.
Ideally, 00:00 means 12'o clock at the start of the day & 24:00 means 12'o clock at the end of the day.
However, SAPUI5 right now does not support 24:00 in sorting. (You can also not select 24:00 as time in date picker, the max you can select is 23:59).
Hence, sorting in my case was correct, how ever it was seeming wrong because 24:00 is converted to 00:00 by UI5.
There is no direct solution provided by UI5. What I did was to reformat the time to 24:00 in formatter.js.

Related

How to dynamically change a field depending on a unique date formula

I'm working on a work schedule of sorts, a feature that I'm trying to create would be one that can be setup initial and would not need to be touched ever again. However I'm not sure where to even start; I have a weekly schedule with three different fields, a middle field that is unique and requires no attention and a day/night field. My user is able to drag users into these fields and set that they are expected to working during that period. However as my user has different shifts that sometimes overlap I'm looking to color code each of the shifts of which there is a total of five, the shifts go on a pattern of working: 2 nights, than 2 days off, than 3 days working and lastly than 2 days off. What would be the best approach of mapping this as I cannot simply put that Monday nights are color X as the by the time next weeks comes around the shift would be starting on Wednesday, along side this some shifts will be working at the same time so the color coding should not cover the entire day but only a limited number of entries (2). My initial idea was to try using Hashmap or something of the sort but I'm uncertain how I would structure it to achieve what I'm looking for..
Drag and drop experience would be nice but I assume not mandatory, so can try to use standard features. Im not sure which user is using this - the worker doing the shift, or a manager allocating workers to the shifts? If is for a manager - If you created a 'shift' object and had shifts represented as records you'd be able to create list views of those shifts ie. 'next n days','this month' etc. Then you could use bulk action within the list view to assign a user to multiple shift records at a time. Would be reasonably efficient and quick to build. Just a thought... (and I couldnt follow what you meant about color coding sorry.)

How to occupy all the days in fullCalendar?

A query for those who have used fullCalendar. I use version 3 of fullCalendar.
I have the dates (the step without hour:minute) start 2020-06-01 end 2020-06-03
But I'm only occupying 2 days as seen in the picture, instead of 3 days [1,3]. I don't know why this happens.
I understand that by default you may be taking the time as 00:00 and this is giving "that problem".
The question would then be, if you need a configuration that takes the full day on the last day, and I don't know if such a configuration will exist?
This is covered in the documentation. End dates are exclusive - see https://fullcalendar.io/docs/v3/event-object .
This means your event is actually considered to end at 2020-06-02 23:59:59. Therefore it doesn't actually occur on 2020-06-03 and so is not shown on that date.
The workaround, if you wish to show it on that day, is to add one day to your end date.

Infinite date scroll - WebSql JavaScript

Is there a built in method for infinite date scrolling?
I am making a database program, and the point is to display data added over especific dates.
Of course I can't do this forever in time:
SELECT * FROM TABLE WHERE date >="2013-04-01" AND date <"2013-05-01
Plus, the month days change every year. You guys have an idea of how should I implement my code to adjust into the dates?
Not sure what you mean by infinite scrolling, but if you're displaying data based on a date range, just pass the date parameters from the UI to the query. If you are displaying 1 month of data at a time, then the user could use Previous / Next button to 'scroll' through time. Or you could let them pick any two dates and see whatever range they need to look at.

jQuery FullCalendar: Can I highlight some time ranges so that users know they are selectable?

I have an application in which the selectable time ranges are variable. That is, in the week view, for monday I may want the user to only be able to select times from 12:00 to 14:00h. On thursday only from 17:00h to 19:00h and so forth.
I know I can handle the select event to constrain the user but I would like to present a visual indication of that time ranges are selectable. I also know I can use minTime and maxTime to limit the time tables but I need the weekView, in which time ranges are variable.
I searched the documentation and the web and found nothing.
Any suggestion?
The weekView (as opposed to the agendaWeek) has no grid of times, so how would you choose where to display the time ranges?
If you mean the agendaWeek the structure of the HTML makes what you want to do very difficult as essentially its made of two superimposed tables, one with the columns and another with the rows (for the different time blocks of half hour or whatever). The only way to do what you want would be to superimpose divs of the right size on top of that matrix. I can give you some hints if you want to attempt that!

Javascript date picker for displaying one week only?

I am looking for a Javascript-based date picker that would allow me to display one week only (instead of the current month).
Ideally it should be one that can be expanded to a full month view if necessary and back again.
Also, (css based?) design customizability would be a plus.
A jQuery solution would be preferred. I've had a brief look at the jQuery datepicker, but it seemed to me that it can only display full months. Please let me know if I am wrong.
The jQuery UI datepicker, as has been noted, can not easily be configured to display only one week. You can however use the maxDate and minDate configuration options to constrain the user's input. Here is an example of this functionality.
To answer your specific question, I am not aware of any datepicker control which will only display one week.
I'm not sure, but maybe you can customize this http://jqueryui.com/demos/datepicker/
Ones that show just one week I know none :(
Edit: After inspect, it shows to be CSS based, I've run through it's options but couldn't find anything just to show one week. Rather there is one which allows you to select only one week though, dunno what the supposed effect is though.
A date picker widget is overkill if you only have seven options. Just use a dropdown. A neat JavaScript trick is that you can add 1 day to any date and it will handle month/year rollovers automatically. The following code will always give you the next 7 days (starting with today):
var dates = [new Date()];
for (var i = 1; i < 7; i++) dates.push(new Date(dates[0].getYear(), dates[0].getMonth(), dates[0].getDate() + i));

Categories

Resources