General
Getting Started
Quick Install
Using with Cordova
Using with Vue.js
Mobiscroll CLI
ES6 Modules
Instance
Utility functions
Upgrade Guide v3
Date & Time pickers
Event Calendar
Form components
Alerts & Notifications
Buttons
Checkbox
Dropdown
Forms
Progress
Radio Buttons
Segmented
Slider
Stepper
Switch
Textfields
Timer
Responsive list
Numeric pickers
Pickers & dropdowns
Layout & navigation
Tools
Accessibility
Utils
A collection of general purpose utility functions which can be used independently from Mobiscroll component instances.
1. Platform
mobiscroll.platform
Description
Information about the current platform.
| Name | Type | Description |
|---|---|---|
| name | String |
Possible values:
|
| majorVersion | Number | The major version of the platform |
| minorVersion | Number | The minor version of the platform |
2. Format Date
mobiscroll.util.datetime.formatDate(format, date[, settings = {}])
Description
Format a date into a string value with a specified format.
Example
// Produces '2015-02-19'
mobiscroll.util.datetime.formatDate('yy-mm-dd', new Date(2015, 1, 19));
Parameters
3. Parse Date
mobiscroll.util.datetime.parseDate(format, value[, settings = {}])
Description
Extract a date from a string value with a specified format.
Example
mobiscroll.util.datetime.parseDate('yy-mm-dd', '2015-02-19'));
Parameters
4. Vibrate
mobiscroll.util.vibrate([time = 50])
Description
Vibrates the device with the specified duration. It checks if the browser/device supports the vibration API, so no additional check is needed.
Example
// Vibrates 200 milliseconds
mobiscroll.util.vibrate(200);
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
| time | Number | 50 | Number of milliseconds to vibrate. |