Mat-Datepicker: how to use ja-JP Dateformat but keep english datepicker language - date

I want the date-format "YYYY/MM/DD" and therefore I use 'ja-JP' in my app.module
providers: [
{provide: MAT_DATE_LOCALE, useValue: 'ja-JP'},
]
I get the right date-format "YYYY/MM/DD" but the datepicker is displayed in japanese.
I would like to keep the default layout
Can you help me?

Related

How can I display the number 10525.25 as 10.525,25 using regexp with Dart?

I want to change my number format. If number like 10525.25 I want to make like this = 10.525,25 If number is 40000.25 it must be like 4.000,25 How can I make this in dart? I use Flutter and I will show this in my Text widget.
The intl package is what you are looking for. It will format numbers in any locale for you. The format you use in your examples is the same as German, for example:
import 'package:intl/intl.dart';
void main () {
final fmt = NumberFormat("#,##0.00", "de_DE");
print(fmt.format(10525.25));
print(fmt.format(40000.25));
}
Output:
10.525,25
40.000,25
You may need to tweak the first parameter to NumberFormat to suit your formatting requirement.

Rendering angular2-datetimepicker

I think this question might be solved without necessarily knowing about the widget. I'm using angular2-datetimepicker (https://www.npmjs.com/package/angular2-datetimepicker) for calendars in my app. The docs are pretty straight-forward, although they always forget how make it work for everyone. I was getting console errors and had to add a name attribute as well as ngDefaultControl to the tag like this:
<angular2-date-picker [(ngModel)]="date" [settings]="settings" name="angular-calendar" ngDefaultControl></angular2-date-picker>
The component has a reference to the model with its settings as stated in the docs:
date: Date = new Date();
settings = {
bigBanner: true,
timePicker: false,
format: 'dd-MM-yyyy',
defaultOpen: true
}
When inspecting the element I get that the widget is (in my opinion) working properly, but it is not displaying:
<angular2-date-picker _ngcontent-c1="" name="angular-calendar" ngdefaultcontrol="" ng-reflect-name="angular-calendar" ng-reflect-model="Mon Jul 02 2018 11:59:53 GMT+0" class="ng-untouched ng-pristine ng-valid"></angular2-date-picker>
When checking the CSS affecting the element I find there are no specific rules applying to it. Any income is appreciated.
Here is an working example stackblitz,
https://stackblitz.com/edit/angular-mmq3ng
Install Commands,
npm install angular2-datetimepicker --save
Import app.module.ts file //maybe error became not imported in your app.
import { AngularDateTimePickerModule } from 'angular2-datetimepicker';
#NgModule({
imports: [
AngularDateTimePickerModule,
]
})
Typescript File,
export class AppComponent {
date: Date = new Date();
settings = {
bigBanner: true,
timePicker: false,
format: 'dd-MM-yyyy',
defaultOpen: true
}
constructor(){}
}
Html File(Iam used same you mentioned thing),
<angular2-date-picker [(ngModel)]="date" [settings]="settings" name="angular-calendar" ngDefaultControl></angular2-date-picker>
Output screenshot,
Make sure you have to import app.module.ts file, AngularDateTimePickerModule this module.

Flatpickr calendar show wrong default date

I have facetwp installed in wordpress and after the search was made, the search widget doesn't show the correct date as per selected before search
how to override this display issue (selected date) by javascript?
To view this problem in action : https://www.sweetpictures.com.my/product-category/photographers/?fwp_photo=2018-01-31%2C2018-01-31%2C1&fwp_productcategory=ampang&fwp_expertise=wedding-reception
Supposed the calendar picker selected date was 31st jan 2018
but instead it shows Aug 20th 2018
Kind help and assistance appreciated
Use the documentation of Flatpickr to set the default date to the one you want : https://chmln.github.io/flatpickr/examples/#supplying-dates-for-flatpickr
That way you can add the following parameters to you flatpickr instance :
//example with jQuery
$('#your-date-element').flatpickr({
minDate: 'today',
dateFormat: 'd/m/Y'
})
If this is not working, try setting the input to the good date with the onReady function in the flatpickr instance :
//example with jQuery
$('#your-date-element').flatpickr({
minDate: 'today',
dateFormat: 'd/m/Y',
onReady: function (selectedDates, dateStr, instance) {
$('#your-date-element input').val(
instance.formatDate(new Date(), 'd/m/Y')
)
},
})

get date using Angular-UI Bootstrap Datepicker inside Modal opened from Grid cell

Maybe this is overkill, but I am trying to
1. open a Modal window, when a link is clicked in UI-Grid
can be done by modifying http://ui-grid.info/docs/#/tutorial/110_grid_in_modal
2. Put a (ui.bootstrap.datepicker) inside the Modal
3. Retrieve the chosen date
4. update the Date Cell in that UI-Grid Row
so, Is Ui-Grid 'well suited'/'can do this' given the above requirements
tia
Nope, not overkill. You can do this with UI-Grid pretty easily. There's a guide on how to do hook up modal editors using Angular Schema Form here: http://brianhann.com/create-a-modal-row-editor-for-ui-grid-in-minutes/ (caveat: I'm the author).
I've also created a new plunker that uses the angular-schema-form-datepicker library to show how you might do this: http://plnkr.co/edit/7t3BI2AUcnvNfav78Btr?p=preview
(plunker has been throwing 404s for files that are part of a plunk so you might have to refresh it)
The main things you have to do are set up your object schema:
scope.schema = {
"type": "object",
"properties": {
"myDate": {
"title": "My Date",
"type": "string",
"format": "date"
}
}
}
Using the same property as your column Defs:
columnDefs = [
{ field: 'myDate', name: 'My Date' }
]
And specify your date format in your form:
form = [
{
key: 'myDate',
format: 'yyyy-mm-dd'
}
]

dygraph on mouse over date format

Is it possible to change the format on the onMouseOver event in Dygraph?
Currently the format is:
YYYY/MM/DD HH:MM:SS
I would like it to display as
MM/DD/YYYY HH:MM:SS
Is it possible to change the current format?
Thanks for your assistance.
Jay
You want to set the valueFormatter option on the x-axis: http://dygraphs.com/options.html#valueFormatter
For example,
new Dygraph(div, data, {
axes: {
x: {
valueFormatter: function(ms) {
return new Date(ms).strftime("%m/%d/%y %H:%M:%S");
}
}
}
});
Live example here: http://jsfiddle.net/eM2Mg/772/
It's worth noting that Date.strftime() is not a standard JavaScript method: it's provided by strftime.js, which is included in the standard dygraphs bundle.