eonasdan datetimepicker century threshold - eonasdan-datetimepicker

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.

Related

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

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.

Automatically set date in the front matter of a Jekyll page

When I create a post, in the front matter I have to insert layout, title, date etc. My concern is regarding date front matter. It is very inconvenient to insert date time and time offset in date field manually.
I'm not able to figure out how to do this automatically. I want the front matter date to update automatically with system time.
The date variable in front matter is an optional variable that you can set to be able to override the date that you set when you title your post according what Jekyll is looking for (i.e. 2019-12-14-post-title.md). It should only refer to the date the post was originally made, and not the current system date. Except for certain edge cases, you really shouldn't have to define date in the front matter.
You can use Liquid templating to post the current time to a page by passing the "now" keyword to date in your liquid template as follows:
This page was last updated at {{ "now" | date: "%Y-%m-%d %H:%M" }}.
to get the the output:
This page was last updated at 2019-12-14 17:48.
However this method has a big drawback for Jekyll usage, because it will refer to the current date when the page was last generated from the template and not when the page is being visited by the user.
The best way to access the current system time is likely to use javascript instead. This is fairly easy depending on your familiarity with the language, but essentially you can make a Date object and then output the info you are looking to display. Here is a quick snippet I made that shows a couple methods that act on the Date object to output different values such as the date, time, and year:
<!DOCTYPE html>
<html>
<body>
<h3>The toDateString() method converts a date to a date string:</h3>
<p id="demo1"></p>
<h3>The toLocaleTimeString() method outputs formatted time:</h3>
<p id="demo2"></p>
<h3>The getFullYear() method outputs the year:</h3>
<p id="demo3"></p>
<script>
// create date object
var d = new Date();
// use toDateString() to output formatted date
document.getElementById("demo1").innerHTML = d.toDateString();
// use toLocaleTimeString() to output formatted time
document.getElementById("demo2").innerHTML = d.toLocaleTimeString();
// use getFullYear() to output year
document.getElementById("demo3").innerHTML = d.getFullYear();
</script>
</body>
</html>
W3schools has a good rundown of the Date object and how to format output if you need more examples and reference on usage.
If you need to know how to use Javascript with Jekyll there is a helpful post on Jekyll Talk that will help.
First of all, you do not HAVE to insert 'layout, title, date etc'. You can use Front Matter defaults for them. This only makes sense for the layout as the title can or should be default, nor the date.
The date MUST be set in your filename and can be overridden in the Front Matter. Please note that this is ONLY true for the built-in collection posts. If you use a custom collection you do not need a date at all.
However, if you choose to use posts nevertheless and you want to add the date automatically, there is only one real option: Use a CMS that automates this input, like Forestry.io or CloudCannon.

How to make the time like 'YYYY-MM-dd HH:mm:ss' when the xAxis's type is time?

When I use echarts to show a table, I make the xAxis type time. What ever I do, the label on the xAxis is like MM-dd hh:mm. So how could I make it YYYY-MM-dd hh:mm:ss?
The echarts version is the newest. I set the maxInterval 1000, but it doesn't work.
You will need to configure the xAxis.axisLabel.formatter: documentation
The example in the documentation itself shows a case that uses Date objects ; since the formatter supports callback functions, you can freely set the format with all the operations you need to make it work.

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>

Formatting a line chart

I have a line chart in a report (rdlc), that I cannot get formatted correctly. There are 2 main things I am trying to accomplish.
1) The x-axis is a date, right now it is being displayed as the full date with time, and I want it to be displayed as mm/dd/yyyy. I have attempted to change this by using =FormateDateTime(Fields!EndDate.Value, DateFormat.ShortDate) This is exactly how I saw it in Microsoft's examples, even the one included in VS2008 (what I am using), but for some reason it says that .ShortDate is and unrecognized identifier. I am thinking this might be a bug. So any ideas on how to get it into the mm/dd/yyyy format?
2) I want the values that are being plotted not to be there actual value but the previous values before added to the value. This is to accomplish a continual upward slope, showing the totals. I would also like to filter out zero's since the first 20 entries are so are 0. When I try to use the filter option it for some reason makes the chart just a flat line.
Any suggestions to any of these problems or a link to a good tutorial would be great as I am new to using these reports. Thanks!
Update: I have accomplished these by applying changes to the actual data being supplied, I would still like to know an easier better way to do this.
You can format the date in the lable under the general tab like this.
=Format(Fields!POWDate.Value, "M/dd/yyyy")
As of now I have fixed the problem by formating the data in the SQL query to the way I would like it to be displayed in the report.