How do I partially update a Date / Time picker value? - material-ui

I'm trying to allow partial updates to a date/time picker: https://mui.com/x/react-date-pickers/getting-started/
The scenario is as follows.. I have a date/time set. And I just want to update the time from AM to PM.
Let's say the starting state is
If I click PM, it'll update the value in the input box to show PM. But then if you click outside of the popup to close it, it'll revert back to AM.
It looks like the only way to set the date/time is to set every date and time option to update it.
Is there a setting on the component to allow partial updates to the date/time as described, so that when closing the popup, it preserves the update?
Thanks.

Related

SSRS Preset or Custom Date Selection on Report

I currently have a report with the ability to select a start and end date. I was curious if you could make have both preset and the option for a custom selection
Selection:
Current Week, or
Previous Week, or
Custom Date Range.
Thanks,
Take a look at cascading parameters.
The link above seems to focus more on getting your cascading parameter values from a query, but you probably don't want that for a date - as far as I am aware, setting Available Values for a date parameter limits you to a dropdown list of dates, instead of the calendar which is generally easier to use. It is still a good background on how cascading parameters work though.
To do this with expressions for the default start/end date, you would basically want the first parameter to be a choice between "Current Week", "Previous Week", and "Custom Date Range". You would display those labels to the user, but the values can be whatever you want - for my test I just used 1, 2, and 3.
Then, you would set up 2 more parameters, one for the start date and one for the end date. Make sure the data type is Date. You will want to set up default values for these based on the value of the first parameter. I would do this with an expression such as the expression below for the start date. You also may need to modify this a bit depending on how you define the week - is the "Current Week" just the previous 7 days, or is it the latest Monday through today, or something else, etc.
=Switch(
Parameters!FirstParam.Value = 1, DateAdd("d", -7, Today()),
Parameters!FirstParam.Value = 2, DateAdd("d", -14, Today())
)
In this case, you don't even need to account for the 3rd option, because if the user wants a custom date range then you do not want the start and end date to fill in with any default values. You would need a similar expression for the default end date as well.
Since you want the user to be able to enter a custom range as well if they were to select the third option, you do not want to fill in the Available Values for the start/end date parameters, as the user would then not be able to select any date (at least as far as I am aware - if there is a workaround to that, I would love to see it, as that would be something I would like to use myself).
A possible downside to this approach is that if the user begins by selecting Current Week and then changes their mind to Previous Week, the start/end dates will not change to the Previous Week. You can read more about why this happens here, but essentially: since the values that are already filled in after selecting Current Week are still valid (they are dates, which is the only criteria for those parameters since no available values are set up), they will not refresh after changing the selection. The fix for this is to define the Available Values, but as mentioned above, this will then stop the user from entering a custom date range.

Oracle apex dynamic date time picker plugin minimum and maximum date

I have added a dynamic date time picker plugin to my oracle apex application. I want to set maximum date to this date picker. current date(or sysdate ) is the maximum date I want to set, the dates after current date should not be available for selection in the date picker.In the default apex date picker I add
+0d
in the maximum date field to set maximum date to current date. But this does not works with dynamic date time picker plugin.Plugin link : Apex dynamic date picker plugin link. How can I do this?
I wanted the same thing and managed to do it today. Here's my solution.
Create a dynamic action in the first Datepicker Calendar with the Change event.
Create the true action "Execute Javascript Code" and use the following code:
$('#P1_SECOND_CALENDAR').datepicker("option","minDate",$("#P1_FIRST_CALENDAR").val());
This function should make the second calendar set its minimum date to the one you've chosen on the first one, and it should happen when you pick it. Previous days should be greyed out on the second calendar once you open it to pick the second date.
Just replace the variables I used for calendars for the ones you have and it should work.
Checking the variables here again, I didn't choose a minimum date on the second Datepicker and APEX automatically chose a "+0d" value for it. It shouldn't be a problem. Try following these steps and see if it works.

XPages date field value changes from AM to PM

I have created a managed bean to handle monitoring field changes on an XPage. The application requires that all changes to fields be logged. I have integrated the bean into a custom control on the XPage and it is created/instantiated when the user toggles the control from read only to editable. There is one Date/Time field set up to display only the date. The Notes document field is also set to display only the date. When the bean is instantiated and the SSJS obtains the date via getComponent - it returns the date like this: mm/dd/yy 12:00 AM. I have another button configured to get all the updated field values when it's clicked. When I click the second button it flags the date field as having been changed when it hasn't. The "updated" value is: mm/dd/yy 12:00 PM. If I trigger the initial and update code in the first button I get AM for both values. When I trigger both initial and update after the control is switched to edit mode by itself I get PM for both values. So it seems that getComponent is returning different values based upon the partial refresh event for readonly to editable. I tried using the afterRender event, but still get the AM/PM problem. Has anyone else encountered this problem? If so, any solutions? Assuming it's an issue with the mode change, any suggestions on how to capture when the change is complete and then trigger my code?
The default value for a date/time field which only stores a date is 12:00 midday. That's to handle Daylight Savings Time adjustments and I suspect the Java Date() to NotesDateTime conversion is doing the manipulation. (NotesDateTimes that are date only are stored with no timezone, so any conversion of 12:00am across DST boundaries may end up changing the date, whcih you don't want; e.g. adjusting 6 June forward 6 months with a time of 12:00AM would change it to 5 Dec, because it would drop back an hour.
I would recommend setting a default value that includes 12:00PM

How to determine if a user has entered only date or also time in the form field?

I have a field where user can enter only date or also time in a text field. Now I know if I make 2 fields, one for date and one for time, I can check if the time field is empty or not.
What I'd like to do is have only one field. If user puts the ending date it takes time only, if user inputs date and time it takes both.
The problem I have is this: If user enters "8.12.2013" it in fact means "8.12.2013 0:0:0" where I convert it to Cdate. But then the end time is the first second of the date 8.12.2013 which means it 8.12.2013 means stop on that date (this is a stop time field). But in fact if a user writes 8.1.2013 it means roll till the end of the day.
Of course I can do date()>"8.12.2013" and it will work, but then if user enters date and time it will not work as it strips time part.
My question: Is there any function in ASP that would check if the time part of the date is set in a variable? I tried to use TIME but it shows 0 for hours, 0 for minutes and 0 for seconds even if the Cdate("8.12.2013") is used. I'd need the function to tell me that the time is not set so I could make a comparation using date() instead of now().
I hope that makes sense.
You could try something as simple as:
If CLng(myDate) = myDate Then ...
Dates are treated as time past a particular date etc., therefore integerising the date will remove the time.
-- EDIT --
Just to add to the above code: The CLng will convert a Date and Time into just a Date. By comparing this against the whole date you can see if any fractional part was included.
Please be aware that this would be considered bad practice in a strictly typed environment, such as .NET, but Classic ASP types are variants and are quite malleable.

SSRS 2008 R2 Report Builder 3.0: Offset Date Default Start Time

I allow the user to enter in what start date and end date they need.I set my start and end date parameters to #Start and #End. They have no values stored in them, rather in my code I have
....Between #Start and #End.
The dates entered by the user gets passed into my program instead of me specifying what the user is allowed to enter in the parameter properties.
My problem is I want the default start of each date picked to be 5:00 AM Instead of 0:00 AM. This way when the user picks for example: 2/20 and 2/21, they can retrieve date from 5:00 AM- 5:00 AM. This enables my program to show data past midnight, which is necessary because my data stops at 3:00 AM.
You can use the DateAdd function to add 5 hours to get 2/20/2013 5:00 AM
Look at this:
=DateAdd("h",5,Parameters!StartDate.Value)
Edit
you can add this line of code in one of the following:
Dataset's parameters section
Right click on your dataset
click on parameters section
Click on the FX button, and put there the line of code
Use this when you use parameters to filter your SQL query
Report's field (i.e textbox, table cell etc..)
Right click on the field
Click on the field expression option, and put there the line of code
The result looks like that: