How to Get TimeZoneOffset From Moment - momentjs

I am using Moment in my project now using same Moment i want to get the timezoneoffset.
import * as moment from 'moment';
I am passing the TimeZone
Europe/Oslo
i want to get the Offset. Please help if somebody done this.

Related

Request returns not actual value

I have written the following code and it works fine. I really enjoyed because I am quite new in python requests or even python3 but at the following day I noticed that the price variable is not updated. And it does not update any time I run the code for a week (709.49 if does it matter). I think it is not a secret so I pasted the whole code below with link to the website.
So I want to ask whether I wrote something in wrong way or the web page is not that simple to make a request. Could you tell me what happened?
Here is the original code:
import requests
import re
from bs4 import BeautifulSoup
pattern = '\d+\.?\d*'
site_doc = requests.get('https://bitbay.net/pl/kurs-walut/kurs-ethereum-pln').text
soup = BeautifulSoup(site_doc, 'html.parser')
price = str(soup.select('title'))
price = re.findall(pattern, price)
print(price)
Thanks in advance!
The reason this doesn't work is that the content you are trying to get is JavaScript rendered. For this, I'd recommend using Selenium in order to get JavaScript rendered content.

Cypress.moment using locale

I am trying to use Cypress.moment to compare dates. The targeted website is in french so the date format.
Therefore, I intended to use moment.js method to switch fr locale.
Cypress.moment.locale('fr')
I should be able to do that as they say on cypress documentation :
Cypress automatically includes moment.js and exposes it as Cypress.moment
https://docs.cypress.io/api/utilities/moment.html#Syntax
Then,
const todaysDate = Cypress.moment().format('Do')
const currentMonth = Cypress.moment().format('MMMM')
cy.get('.date__title').should('contain', todaysDate)
cy.get('.c-title').should('contain', currentMonth)
But the assertion fails as cypress refuse to take into account the fr locale. It keeps comparing 'décembre' with 'december' for instance. Which fails obviously.
I am doing something wrong ?
in the same aforementioned thread, a working answer recently surfaced:
put this in support/index.js:
Cypress.moment.locale('de');
it worked brilliantly in my project
Unfortunately, at the time of writing, I think this is not possible with Cypress.moment.locale(), as you can see in this issue in their git repository.
As commented there moment.locale requires an import in addition to the standard moment import, that import is moment-with-locales.min.js and has not been included in Cypress.

Ionic 2 Date Pipe adds hour

I've got a webservice which provide my app from data.
Currently I've got issues with dates.
In my Ionic pages i use the date pipe like this:
{{model.DateStart | date: 'dd-MM-yyyy HH:mm'}}
This results in '18-02-2017 14:08', thats good.
But when the service sends this '2017-02-18T15:00:00' the result is '18-02-2017 16:00'.
That's not good.. It adds a hour somewhere.
It'll have to do with the locale settings somewhere, but I don't know how to fix it.
Anyone knows how to fix this problem?
After implementing moment.js I get the result I want.

is there any way to import third party JS into mongoJS...?

I am looking for a function to convert UTC timestamp to another timezone timestamp.
It needs two parameters,
utcTimestamp(1464891132) &
timezoneString("Asia/Kolkata")
function convertToTimeZone(utcTimestamp, timezoneString) {
//do some operations and
return "timestamp in given timezone";
}
I just checked link and found that there are some js libs, which solve that conversion problem, but now my problem is how can I import third party js to my mongoJS.
Or is there any patch or alternative to solve these problem in mongojs?
FYI I am using mongoJS from mongoshell....

HERE SDK Geocode Request

I'm trying to using GeocodeRequest to get the coordinate by giving place name like this http://heremaps.github.io/examples/explorer.html#geocoding
and I had checked and follow the documentation https://developer.here.com/mobile-sdks/documentation/android/topics/geocoding.html, but I get error with the listener
http://i.stack.imgur.com/R2rk1.png
Does anyone have experience of this?
Check the import statement of the Location class,
I guess you are importing android.location.Location, you should import com.here.android.mpa.search.Location

Resources