set locale via device local

Signed-off-by: Benny Samir Hierl <bennysamir@posteo.de>
This commit is contained in:
Benny Samir Hierl 2020-10-28 19:50:48 +01:00
parent a144fe6c03
commit fcd265a6e5
No known key found for this signature in database
GPG key ID: 69DE3C3C097DB7F7
4 changed files with 5 additions and 11 deletions

View file

@ -1,7 +1,7 @@
// Variables used by Scriptable.
// These must be at the very top of the file. Do not edit.
// icon-color: light-brown; icon-glyph: magic;
// Version 0.1.0 Beta-Version
// Version 0.1.1 Beta-Version
/****************************
Notice
@ -11,8 +11,8 @@ The search pattern list must be constantly expanded.
If the dial-in data of a meeting should not be recognized, the invitation can be provided under https://github.com/ThisIsBenny/iOS-Widgets/issues/21, so that the list of search patterns can be extended.
*****************************/
let timeformat, countryCode
let countryCode
let timeformat = Device.locale().replace('_', '-')
let widgetInputRAW = args.widgetParameter;
let widgetInput = null;
@ -20,13 +20,11 @@ let widgetInput = null;
if (widgetInputRAW) {
widgetInput = widgetInputRAW.toString().split(';')
countryCode = widgetInput[0]
timeformat = widgetInput[1] || 'de-DE'
if (/^\+[\d]{1,3}$/.test(countryCode) === false) {
throw new Error('Invalid format of country code: ' + countryCode);
}
} else {
countryCode = '+49'
timeformat = 'de-DE'
}
const listLimit = (config.widgetFamily == 'medium') ? 1 : 5;
@ -41,6 +39,7 @@ if (Device.isUsingDarkAppearance()) {
let now = new Date()
let end = new Date()
end.setHours(23, 59, 59, 999);
end.setDate(31)
const matchPatterns = {
skype: {

View file

@ -15,11 +15,6 @@ The following services are currently supported:
Via the widget parameters the country code has to be set. This code has to start with a +. Example: +49
The country code is needed in case several international phone numbers are found (please check notice 1, because a country code does not automatically mean that the phone number is found).
### Optional
By default, the german date format will be used: DD.MM.YYYY, HH:mm
To use a different format, the format has to be set to the widget parameter. The format has to be separated from the country code with a ;
![Meeting dial in Widget setup](https://raw.githubusercontent.com/ThisIsBenny/iOS-Widgets/main/Meeting-dial-in/setup.jpeg)
## Notice 1

Binary file not shown.

Before

Width:  |  Height:  |  Size: 32 KiB

After

Width:  |  Height:  |  Size: 29 KiB

View file

@ -16,7 +16,7 @@
},
{
"name": "Meeting dial in",
"version": "0.1.0",
"version": "0.1.1",
"scriptURL": "https://raw.githubusercontent.com/ThisIsBenny/iOS-Widgets/main/Meeting-dial-in/Meeting-dial-in.js",
"previewURL": "https://raw.githubusercontent.com/ThisIsBenny/iOS-Widgets/main/Meeting-dial-in/previewLight.jpeg",
"descriptionURL": "https://github.com/ThisIsBenny/iOS-Widgets/blob/main/Meeting-dial-in/README.md"