Change the date format for the showLastUpdateTime at the bottom of pages - date

I've added the
showLastUpdateTime: true,
line to my docusaurus.config.js, and the date is showing at the bottom of documents, but the format is US (which doesn't work for the majority of the world). I need it to be unambiguous, or not 'wrong' :D
Does anyone know how I can change this?

I don't believe you can explicitly set the format manually - it uses the default Intl.DateTimeFormat constructor under the hood - however you can manipulate it by setting the base locale of your site to something other than the default.
To do this, you need to leverage the i18n configuration - add this to your docusaurus.config.js:
i18n: {
defaultLocale: 'en-GB',
locales: ['en-GB']
}
Substitute en-GB for whatever your desired locale is, and you'll see the date show in that locale's format, so in the UK it's dd/MM/yyyy.

Related

CakePHP 4 Date format for FormHelper->date() how to change to UK format

I have the following code in a template:
<?= $this->Form->date('selected_date', ['required' => true]) ?>
This displays a lovely new dynamic date picker, but with the US format "mm/dd/yyyy". What I want is "dd/mm/YYYY"
In app.php I've set the APP_DEFAULT_LOCALE to en-GB.
In AppController.php I've set the following:
I18n::setLocale('en-GB');
Time::setDefaultLocale('en-GB'); // For any mutable DateTime
FrozenTime::setDefaultLocale('en-GB'); // For any immutable DateTime
Date::setDefaultLocale('en-GB'); // For any mutable Date
FrozenDate::setDefaultLocale('en-GB'); // For any immutable Date
How do I change the format? I can't find anything in the docs or online.
You can't change it, at least there's no reliable, cross browser/device compatible way, the control is rendered by the browser, and the current state of things is that browsers use the locale the browser currently runs in to format the control.
If you want something solid, then you'll have to use a custom JavaScript datepicker. If you want to walk on the edge, look into web components.
See also Is there any way to change input type="date" format?.

Date Format - Change format of Month from String to Numeric Value

I would think this is relatively straight forward but cant find documentation on how to do it(or the correct syntax to use) and my messing around hasn't worked so far.
For Dates we have a custom format called Month /Day /Year. This pulls back a the date(as a date type) in date format as such:
"14 April 2003"
The code behind this is:
(DATEPART('year', [Close Date])*10000 + DATEPART('month', [Close Date])*100 + DATEPART('day', [Close Date]))
What I want to get back is the month is numeric format like:
"14.04.2003"
Is it simply changing the "month" part in the code to a different type? Has any one come across this?
Cheers
lampbob, I'd just use date formatting which will mean you will still be able to use all the date-fields flexibility that Tableau provides.
Select Custom format with the following input:
dd.mm.yyyy
See the screen below for more details:
This can be easily achieved using the 'Format' option in Tableau. Here are the steps to follow to format the date field as you have specified.
Add Date field to your Rows/Columns field on a Tableau worksheet.
Set the format of the Date to be DAY(Date).
Click on options for 'DAY(Date)' and go to 'Format...'
On the Format DAY(Date) panel, go to Scale -> Dates.
Select 'Custom' option and type in 'mm.dd.yyyy'. Now the date will be in the string format you need.
Screenshots:
String format for date,
Changing to 'DAY' and 'Format...'
If you are only concerned about how the date is presented, then leave the datatype as a date, and use a custom format string via the format pane to display it as desired.
Followed your advice and just had to change the date pill, in the column field, to a continuous value. Then right clicked -> format -> Scale -> custom. Then used the above suggested format setting. Thanks Petr, woodhead92.

eonasdan datetimepicker century threshold

Any tips would be welcome: I need the datetimepicker to transform a date earlier than 1969 to that year in the 20th century. So if I enter 12-12-69 the datetimepicker transforms that into 12-12-1969. Entering 12-12-68 though is transformed into 12-12-2068. I assume this is done in moment.js, but I may be mistaken. If it is done in moment.js anyone have an idea where to look to change the threshhold for this automagic transformation? I'd rather change it in the library than use parseInputDate, but if anyone has an example on usage of parseInputDate, please share. I have found that the date already has been changed automagically as ddescribed above when I try and access the date-object via:
$('#datefrom').on('dp.change',function(e) { console.log(e.date); });
I need to access the date object B4 this happens. It works to set a onchange="dostuff()" inline on the input field itself, but that sort of feels wrong, as I want to handle this in one place in the datetimepicker and not in 50 places inline.

Override language specific pattern in iReport

How can I override the language specific pattern in iReport? I have set the pattern #,##0.00 on a field with a Double value.
If the report is in english, I get the following example output.:
10,000.00
If the report is in german, I get the following example output.:
10.000,00
I need the output 10.000,00 for the english and the german report.
How can I realize that?
Do not set any pattern (make sure to remove it). Instead, in the TextFieldExpression field use
new java.text.DecimalFormat("#,##0.00", new java.text.DecimalFormatSymbols(java.util.Locale.GERMANY)).format($P{parameter1}).
(This is a string. If your textfield expression class is double, you can parse the result.)
This will format the number as in German locale for all languages.
The latest versions of iReport has a feature called Pattern Expression. In that you only need to specify a pattern string, and leave the rest of the field calculation the same. This way you can separate the data from the format, I think it keeps things cleaner, but it also gives you more control over the format at runtime.
Edit. An example was asked for, here it is:
https://gist.github.com/ilopez/9369809#file-so22141769-jrxml
The magic happens in this expression:
new DecimalFormat().toPattern()
You can specify report locale via the REPORT_LOCALE parameter see: Setting REPORT_LOCALE in IReport?

JQuery Mobile/Datebox, difference between display date format and submit date format

Is there a way to display a date in an input different from the format I want to submit.
For example I have to submit a date in "yyyy-mm-dd" format but I want to display the date in another format : "dd/mm/yyyy" (french display).
Is there a good tip to do that with Datebox for jQuery Mobile (an option I didn't see ?)
I think I have to cheat in creating an input hidden with the good form format and another one with the format to display (and not submitted), but maybe a better solution exists.
Any ideas ?
Your best bet is to indeed use 2 inputs - but, it's pretty easy to do, and using a callback on the set event, you can even make datebox do the second format for you.
http://dev.jtsage.com/jQM-DateBox2/demos/script/split.html
(Note: I just added the demo, so you didn't miss it earlier)
Just a small addition
It should be "overrideDateFormat":"%d/%m/%Y" in the HTML inline options.
In http://dev.jtsage.com/jQM-DateBox2/demos/script/split.html it states "dateFormatOverride":"%d/%m/%Y"} however this is incorrect and doesn't work. Just a heads up for anyone else with this issue.
Yes you need to use this method.
<!-- fix american date formatting -->
<script type="text/javascript">
jQuery.extend(jQuery.mobile.datebox.prototype.options, {
'overrideDateFormat': '%d/%m/%Y',
'overrideHeaderFormat': '%d/%m/%Y'
});
</script>