How to get leading zeros displayed in the Vaadin DateTimePicker component? - vaadin

In my Vaadin Flow application, I'm using the Vaadin DateTimePicker component. If I select a date, it will be displayed without the leading zeros (e.g. "4.7.2021"). I would like the component to display the leading zeros (e.g. "04.07.2021"), but I could not find an API call to do so. Locale is Switzerland. Any ideas? I guess I'm missing a really easy solution to this all-day-problem…

You should use the EnhancedDatePicker https://vaadin.com/directory/component/enhanced-datepicker
There you can set pattern and even parsers. For example:
// how the date should be formatted
datePicker.setPattern("dd.MM.yyyy);
// allowed formats to enter the date
datePicker.setParsers("ddMMyy", "ddMMyyyy", "dd.MM.yy", "dd.MM.yyyy");

Related

HTML5 charts-Customizing tooltip formatting in Jasper Studio

I am using HTML5 bar charts for one of the report. I have a question on tooltip formatting option we have for charts. I need to display amount values for each of the series (coutry in my case) in the graph and the amount should be formatted based on each currency. So, the decimal format will change for each value.
Under Tooltip -> Formatting, I see an option called Value decimals which allow us to configure the decimal places. But, this is a constant value and I cannot get different decimal points for different series. I tried to use the expression in this field but it is not helping as the bar chart is present in summary band and always picks up last value. Is there any way to include custom formatting in "Point Format" option of formatting? I tried to include some HTML codes in it, but it is not working. Please do let me know if there are any other way to handle this issue.
I tried using tooltip.Formatter function, but I don't see that formatting has been applied to the chart result. Below are the values I am using in different properties.
tooltip.formatter - "(function() {return this.series.name + '<b>'+ Highcharts.numberFormat(this.point.y, this.point.exponent)+ '</b>' ; } )"
tooltip.pointFormat - <span style="color:{point.color}">●</span> {series.name}: <b> {point.y} </b><br/>
(point.exponent is a bucket property I defined for each series)
Could you please let me know what I am doing wrong here ?
This is working now. We need to enable function execution for highcharts in Jasper studio preferences and once we do that, the above solution is working fine.

Issue with masked textbox for website address using kendo ui

I am using kendo ui to for the masked textbox. I am done with phone number and fax number. but i want to put "http://_________________" for website textbox which should be variable length string. How can i achieve that?
I used following way to achieve phone number.
#(Html.Kendo().MaskedTextBox()
.Name("phone_number")
.Mask("(999) 000-0000")
.Value("555 123 4567")
)
For the time being, the MaskedTextBox widget works only with strict mask length. In other words, the widget's mask defines the length of the input, which cannot be dynamic.
I am afraid that this is a limitation with the widget and there is no feasible workaround for it.
You can vote for this functionality here:
Kendo UserVoice discussion

Comparing Dates in Delphi 7 using DateTimePicker components

I am trying to dynamically assign a date to two DateTimePicker components, and then comparing the two.
I have two conditions that I want to do here. In the first, I want to test if the date given to the component is the same as the current date. I do it like this:
if DateClosed.date = DateCurrent.date then
begin
//some code goes here
end;
In the second instance I am trying to test if the date provided to dateClosed falls on or between two other dates that is also provided to two DateTimePicker.
I am using Borland Delphi 7 Professional.
Please try to keep answers as simple as possible, as I am fairly new to Delphi.
TDateTimePicker.Date includes a time component (a fractional part to the right of the decimal point) even when you've specified that you only want a date. This causes the comparison to fail, because even though the date portion (the part to the left of the decimal) might match exactly, the fractional portion doesn't.
If you only want to compare the date parts (ignoring any time difference), just remove the fractional part using Trunc (in the System unit, so automatically available without adding anything to your uses clause):
if Trunc(DateClosed.Date) = Trunc(DateCurrent.Date) then
// The dates are the same
For more info, see the Delphi help file - the XE3 documentation is here, but it hasn't changed since Delphi 7.

What formats can I use for an xforms:input bound to a node of type xs:date?

I am looking at the <xforms:input> formatting documentation and am curious if it is at all possible to display the date as "3 Jul 2011". This should formatting very simple given the use of Java's SimpleDateFormat with the mask [d] [MMM] [yyyy]. The <xforms:input> documentation makes it seem possible to change the canonical format but only references Regex expressions.
Or am I restricted to the masks [M], [D] and [Y]?
You can choose pretty much any format you want when displaying a date or time with <xforms:output>. However, when capturing a date or time with <xforms:input>, Orbeon Forms limits you to just a few formats, as documented.
The reason for this is somewhat technical: for inputs, Orbeon Forms needs to be able to both format the date/time in the format you specify, and to parse it. And the parsing is implemented to accept as many reasonable date or time formats entered by the user. For instance, if you choose a [M]/[D]/[Y] format (typical in the US), you can enter 12/2/2011, but also 12/2 (skipping the year), or even 2 (skipping both the year and the month), or today, as well as several other formats.
The bottom line is that because of this "smart parsing", the <xforms:input> can only support a number of predefined formats. Additional formats can be added, but this requires Orbeon Forms itself to be changed to support those additional formats.

Negative decimals in (parentheses) not binding

I'm using String.Format("{0:####.00;(####.00);0.00}", Model) to display a negative currency of -1600.00 as (1600.00). However, decimal inputs in this format cannot be parsed by the model binder.
I suspect I need to change a culture setting, but I don't know where.
How do I tell my ASP.NET MVC 3 application that a decimal form input value of (1600.00) means -1600.00?
Solved. See answer below.
Solved by keeping my display templates' formatting and changing my editor templates to use a standard minus without parentheses.

Resources