I have searched the forum. I got very close answers and I am able to partly solve the problem I am facing, but need a little more clarity whether this is possible or any available option is there. The problem is like below.
I am using SAP UI5.
I have DatePicker in one screen and there the date pattern is shown using the code below:
this._enddatepicker = new mii.control.miiDatePicker({ value: { path: "/dateValue", type: new sap.ui.model.type.Date({ pattern: "MM-dd-yyyy" })} });
So now it shows 08-29-2000
But I want to show the dates As per Local PC/System Date; So if Date is shown in toolbar as 2000-08-29, in the screen it needs to show in the same format. For that I have used the below code:
this._enddatepicker = new mii.control.miiDatePicker({ value: { path: "/dateValue", type: new sap.ui.model.type.Date({ setLocal:oLocale })} });
But here is the problem: it is taking the LongDate format. So if the long date format is dd-MMMM-yyyy it shows 29,August 2000. but the Date in the toolbar is in short date format dd-MM-yyyy, which I need to display on the screen.
Are there any options or ways to show the same?
this._enddatepicker = new mii.control.miiDatePicker({
value: {
path: "/dateValue",
type: new sap.ui.model.type.Date({
setLocal: oLocale
}),
// you can specify style as long/short/medium/full
formatOptions: {
style: 'medium'
}
}
});
Related
I am using PDFJS and the viewer. I do however have the problem that annotation are not shown correctly like the are in the pdfs demo viewer https://mozilla.github.io/pdf.js/web/viewer.html.
Annotation correctly displayed in pdfs demo viewer:
Here is now it is displayed in my app using Chrome:
Here is how it is displayed I Safari using my app:
This is now I initialise the pdfs viewer:
function initPdfjs() {
// Enable hyperlinks within PDF files.
pdfLinkService = new (pdfjsViewer as any).PDFLinkService({
eventBus,
});
// Enable find controller.
pdfFindController = new (pdfjsViewer as any).PDFFindController({
eventBus,
linkService: pdfLinkService,
});
const container = document.getElementById('viewerContainer');
if (container) {
// Initialize PDFViewer
pdfViewer = new (pdfjsViewer as any).PDFViewer({
eventBus,
container,
removePageBorders: true,
linkService: pdfLinkService,
findController: pdfFindController,
});
// pdfViewer.textLayerMode = Utils.enableTextSelection() ? TextLayerMode.ENABLE : TextLayerMode.DISABLE;
pdfViewer.textLayerMode = TextLayerMode.ENABLE_ENHANCE;
// See https://github.com/mozilla/pdf.js/issues/11245
if (Utils.isIos()) {
pdfViewer.maxCanvasPixels = 4000 * 4000;
}
pdfLinkService.setViewer(pdfViewer);
return;
} else {
console.error(`getElementById('viewerContainer') failed`);
}
}
What do I need to do in order to get the annotations to display correctly in my app?
I got it working. I don't know if it is the right way, but I post it in case somebody can use it.
First I setup webpack to copy the content from ./node_modules/pdfjs-dist/web/images to my dist folder so the images got included. That solved all the display errors except {{date}}, {{time}}.
new CopyPlugin({
patterns: [
{ from: './node_modules/pdfjs-dist/web/images', to: '' },
{ from: './l10n', to: 'l10n' },
],
}),
To solve the {{date}}, {{time}} problem I set up a localisation service. I did that by copying the file ng2-pdfjs-viewer-master/pdfjs/web/locale/en-US/viewer.properties to ./l10n/local.properties in my project. Then it is copied to the dist folder by above webpack plugin. I then setup the l10n service in my pdfjs by adding this code:
// initialize localization service, so time stamp in embedded comments are shown correctly
l10n = new (pdfjsViewer as any).GenericL10n('en-US');
const dir = await l10n.getDirection();
document.getElementsByTagName('html')[0].dir = dir;
and added l10n to PDFViewer initialisation:
// Initialize PDFViewer
pdfViewer = new (pdfjsViewer as any).PDFViewer({
eventBus,
container,
removePageBorders: true,
linkService: pdfLinkService,
findController: pdfFindController,
l10n,
});
And now annotations is shown correctly:
What I find a bit weird is the date format. I used en-US as locale, so I would expect it to be mm/dd/yyyy (American way), but it is dd/mm/yyyy (like a dane would prefer it). I have tried to fool around with the date settings on my Mac and language settings in Chrome, but it doesn't look like it has any effect, so I don't know what to do if an American customer complains.
I would like to display "Loading" when my chart's data are fetching and if there's no data - I'd like to display "No Data". I tried with loading and noData properties from Highcharts API, but the effect is always the same - "Loading" overlaps with "No Data", and after some time "Loading" vanishes. Could anyone give me example where these two properties works fine when they are used simultaneously?
I prepared two demos shows how to achieve it.
In the first, the chart is initialized with the series config (the data is an empty array) and I used the setTimeout as a simulation of fetching data. When data comes the series is updated depending if a new data is an empty array or not.
Demo: https://jsfiddle.net/BlackLabel/1dg2zyus/
setTimeout(function() {
let data = [];
//let data = [1,2,3,4,5];
if (data.length) {
chart.series[0].update({
data: data
})
}
chart.hideLoading();
}, 1000)
In the second demo - the chart is initialized without the series config. Again, setTimeout is used as a simulation. When data comes - we can use the addSeries feature this time to add the data to the chart.
Demo: https://jsfiddle.net/BlackLabel/97jd2v5e/
setTimeout(function() {
let data = [];
//let data = [1,2,3,4,5];
if (data.length) {
chart.addSeries({
data: data
})
}
chart.hideLoading();
}, 1000)
API: https://api.highcharts.com/class-reference/Highcharts.Chart#addSeries
API: https://api.highcharts.com/class-reference/Highcharts.Series#update
I am seeing different values on iOS (Safari and Chrome) than on Android or PC. My HTML is
<timepicker id="fromDatePicker" (keyup)="writeTime($event)"
[(ngModel)]="event.durationFrom" [showMeridian]="ismeridian"
[minuteStep]="1"></timepicker>
And in typescript I create a Date from a UTC string
this.event.durationFrom = new Date(event.calEvent.end.format());
On PC/Android the value displayed for Hours is the same as the UTC hours but on iOS the hours displayed is offset by the default timezone offset. This results in different data being saved. is there any way to force the iOS implementation to use UTC or ignore timezone?
This is not a problem with ngx-bootstrap or the timepicker module. The problem was my fullcalendar library and its moment library were ending with different date values on ios. I am not sure how best to deal with this problem although I did create a workaround.
setDateForTimePicker(calMoment) {
let utcDt = new Date(calMoment.toISOString(true));
let assetDt = new Date(calMoment);
if (utcDt.getHours() != assetDt.getHours()) {
return new Date(
assetDt.getTime() + assetDt.getTimezoneOffset() * 60 * 1000
);
} else {
return new Date(utcDt.getTime() + utcDt.getTimezoneOffset() * 60 * 1000);
}
}
I am making a calendar app and want to create a view for each event, instead of using EventKitUI. When I get the data with like;
let eventStore = EKEventStore()
if let val = eventStore.eventWithIdentifier(id) {
print(val)
}
It shows
startTimeZone = US/Pacific (PST) offset -28800;
startTimeZone = America/New_York (EST) offset -18000 ...
When I get timezone data with;
print(val.timeZone)
It shows only first one. I need to second one too!
Optional(US/Pacific (PST) offset -28800)
How can I get it? The second timeZone must be for endDate.
I should have tested... I think it is a kind of bug. Anyway, I wrote the answer for the people like me.
val.valueForKey("startTimeZone") //you can get first one
val.valueForKey("endTimeZone") //you can get time zone for end.
Hello I've been expirimenting with the Google Picker API (http://code.google.com/apis/picker/). I've got a working demo (code below) that searches for YouTube movies.
This current version returns all videos. I'm trying to filter the results so it'll only list search results from youtube.com. The picker API supports this. But I don't understand the API documentation.
The documentation (http://code.google.com/apis/picker/docs/reference.html) mentions 'VideoSearchView.YOUTUBE' and describes it as "A string constant suitable for the VideoSearchView.setSite() method".
I don't understand how to implement this filter in my code below. Any help is appreciated.
<!--
Needs work; it should only display YouTube videos.
http://code.google.com/apis/picker/docs/reference.html
Change the key parameter for a domain+path specific API key. Get one here: http://code.google.com/apis/loader/signup.html.
-->
<script type="text/javascript" src="http://www.google.com/jsapi?key=ABQIAAAANAaPTI0Sup-knGFaDbCNHBSXhCTdTCKo5q_OHnpA1qEpBIP8mRTtPnObFFbe_J21oviL78C86yxHUA"></script>
<script type="text/javascript">
google.load('picker', '1', {'language':'nl'});
function googlePicker()
{
/*
Displays the users own YouTube movies:
picker = picker.addView(google.picker.ViewId.YOUTUBE);
Displays all videos:
picker = picker.addView(google.picker.ViewId.VIDEO_SEARCH);
Displays all videos from youtube.com:
???
Example query that returns non-YouTube results: "Mobile Healing Rooms: Following Jesus on Vimeo"
*/
var picker = new google.picker.PickerBuilder();
picker = picker.addView(google.picker.ViewId.VIDEO_SEARCH);
picker = picker.enableFeature(google.picker.Feature.NAV_HIDDEN);
picker = picker.setTitle('Selecteer een YouTube video');
picker = picker.setCallback(googlePickerCallback);
picker = picker.build();
picker.setVisible(true);
}
function googlePickerCallback(data) {
var youTubeUrl = (data.action == google.picker.Action.PICKED) ? data.docs[0].url : '';
if (youTubeUrl != '')
{
$('#block_youtube_url').val(youTubeUrl);
}
}
</script>
Try the equivalent of the following:
// Create and render a Picker object for searching YouTube videos.
function createPicker() {
var picker = new google.picker.PickerBuilder().
addView(new google.picker.VideoSearchView().
setSite(google.picker.VideoSearchView.YOUTUBE)).
setCallback(pickerCallback).
build();
picker.setVisible(true);
}
If you add views by ViewId, you don't get a chance to call view-specific methods. This is why some View-derived classes are exposed.