nativescript-sdk-utility
This plugin is a collection of utilities for iOS and Android to simplify your NativeScript apps.
npm i --save nativescript-sdk-utility
- Version: 1.0.9
- GitHub:
- NPM: https://www.npmjs.com/package/nativescript-sdk-utility
- Downloads:
- Last Day: 0
- Last Week: 0
- Last Month: 0
NativeScript SDK Utility
This plugin provides device specific functions that simplify your NativeScript apps.
- getVersion(): Returns the current version of your app.
- getBuild(): Returns the current build of your app.
- is24HFormat(): Returns a boolean value that indicates if the device is using a 24H time format.
- formatDateTime(date?: Date, pattern?: string, locale?: string): Returns a date based on given pattern.
Installation
tns plugin add nativescript-sdk-utility
Usage
```JavaScript
var utility = require('nativescript-sdk-utility');
var sdk = new utility.SDKUtility();
var version = sdk.getVersion();
var build = sdk.getBuild();
var is24H = sdk.is24HFormat();
var datetime = this.sdk.formatDateTime(new Date(), "MM/dd/yyyy h:mm");
```)
```TypeScript
import { SDKUtility } from 'nativescript-sdk-utility';
export class MyModel {
public version: string;
public build: string;
public is24H: boolean;
private sdk: SDKUtility;
constructor() {
super();
this.sdk = new SDKUtility();
this.version = this.sdk.getVersion();
this.build = this.sdk.getBuild();
this.is24H = this.sdk.is24HFormat();
this.datetime = this.sdk.formatDateTime(new Date(), "MM/dd/yyyy h:mm");
}
}
```
License
Apache License Version 2.0, January 2004