utils/common

Namespace

utils/common

Source:

Methods

(static) exports.daysInMonth(month, year) → {number}

Description:
  • Month here is 1-indexed (January is 1, February is 2, etc). This is because we're using 0 as the day so that it returns the last day of the last month, so you have to add 1 to the month number so it returns the correct amount of days

Source:
Parameters:
Name Type Description
month number
year number
Returns:
Type
number

(static) exports.getCountryDate(dateString, selectedTimezone) → {string}

Description:
  • Parse date in format DD/MM/YYYY, with selected country time zone

Source:
Example
2020-04-27T09:18:02Z
parsed to   "27/04/2020"
Parameters:
Name Type Description
dateString Time
selectedTimezone string
Returns:
Type
string

(static) exports.getCountryDateTime(dateString, selectedTimezone) → {string}

Description:
  • Parse date in format DD/MM/YYYY, time in format hh:mm:ss with selected country time zone

Source:
Example
2020-04-27T09:18:02Z
parsed to   "27/04/2020 09:18:02"
Parameters:
Name Type Description
dateString Time
selectedTimezone string
Returns:

Parsed date and time

Type
string

(static) exports.getCountryNewDate(selectedTimezone, date) → {Date}

Description:
  • get javascript date object in nigeria time

Source:
Parameters:
Name Type Description
selectedTimezone string
date Time
Returns:

Parsed date and time

Type
Date

(static) exports.getDate(dateString) → {string}

Description:
  • Parse date in format DD/MM/YY

Source:
Example
2020-04-27T09:18:02Z
parsed to   "27 / 04 / 20"
Parameters:
Name Type Description
dateString Time
Returns:

Parsed date and time

Type
string

(static) exports.getDateForCalendar(date) → {string}

Description:
  • Parse date in format YYYY/MM/DD

Source:
Example
new Date()
parsed to   "17/05/2020"
Parameters:
Name Type Description
date Time
Returns:
Type
string

(static) exports.getDateForFilter(date) → {string}

Description:
  • Parse date in format YYYY-MM-DD

Source:
Example
new Date()
parsed to   "2020-05-07"
Parameters:
Name Type Description
date Time
Returns:
Type
string

(static) exports.getDateForIntervalFilter(date) → {string}

Description:
  • Parse date in format YYYY-MM-DD hh:mm

Source:
Example
new Date()
parsed to   "2020-05-07 23:59"
Parameters:
Name Type Description
date Time
Returns:
Type
string

(static) exports.getDateFromString(date) → {string}

Description:
  • Parse date in format YYYY-MM-DD

Source:
Example
"07/05/2020"
parsed to   "2020-05-07"
Parameters:
Name Type Description
date string
Returns:
Type
string

(static) exports.getDateTime(dateString) → {string}

Description:
  • Parse date in format DD/MM/YYYY, time in format hh:mm:ss

Source:
Example
2020-04-27T09:18:02Z
parsed to   "27/04/2020 09:18:02"
Parameters:
Name Type Description
dateString Time
Returns:

Parsed date and time

Type
string

(static) exports.getDateTimeWithUserTimezone(dateString) → {string}

Description:
  • Parse date in format DD/MM/YYYY, time in format hh:mm:ss with time zone

Source:
Example
2020-04-27T09:18:02Z
parsed to   "27/04/2020 09:18:02"
Parameters:
Name Type Description
dateString Time
Returns:

Parsed date and time

Type
string

(static) exports.getFilterUTCDate(payload) → {string}

Description:
  • get UTC string date

Source:
Parameters:
Name Type Description
payload object
Returns:

utc date time

Type
string

(static) exports.getMonth(date) → {Time}

Description:
  • Get Month in format mm YYYY

Source:
Example
new Date()
parsed to April 2020
Parameters:
Name Type Description
date Time
Returns:
Type
Time

(static) exports.getOffsetByTimezone(selectedTimezone) → {integer}

Description:
  • get offset depending on selected timezone

Source:
Parameters:
Name Type Description
selectedTimezone object
Returns:

offset

Type
integer

(static) exports.getToday(selectedTimezone) → {Time}

Description:
  • Get today

Source:
Parameters:
Name Type Description
selectedTimezone object
Returns:
Type
Time

(static) exports.getUCTDateFromCountryDate(countryOffset, date) → {string}

Description:
  • get javascript date object in utc time from country time

Source:
Example
2020-04-27T09:18:02Z
parsed to   "27/04/2020 09:18:02"
Parameters:
Name Type Description
countryOffset string
date Time
Returns:

Parsed date and time

Type
string

(static) exports.getYesterday(selectedTimezone) → {Time}

Description:
  • Get day before today

Source:
Parameters:
Name Type Description
selectedTimezone object
Returns:
Type
Time

(static) exports.parseAmount(value, divider) → {string}

Description:
  • Parse amounts

Source:
Example
parseAmount(5000000,1)
parsed to   "5,000,000.00"
or parseAmount(5000000,100)
parsed to   "50,000.00"
Parameters:
Name Type Description
value number
divider number
Returns:
Type
string

(static) exports.parseBonusSettings(bonusSettings) → {Array}

Description:
  • Parse bonus time allowed string

Source:
Parameters:
Name Type Description
bonusSettings Array
Returns:
Type
Array

(static) exports.parseDecimal(value, divider) → {string}

Description:
  • Parse float

Source:
Example
parseDecimal(5000000)
parsed to   "50000.00"
Parameters:
Name Type Description
value number
divider number
Returns:
Type
string

(static) exports.parsePoints(value, sign) → {string}

Description:
  • Parse points

Source:
Example
parsePoints(5000000,'.')
parsed to   "5.000.000"
Parameters:
Name Type Description
value number
sign char
Returns:
Type
string

(static) exports.parsePointsSettings(pointsObject) → {Array}

Description:
  • Parse points object into array

Source:
Parameters:
Name Type Description
pointsObject object
Returns:
Type
Array

(static) exports.parseRoundDetails(roundDetails) → {object}

Description:
  • Parse round details response

Source:
Parameters:
Name Type Description
roundDetails object
Returns:
Type
object

(static) exports.revertBonusSettings(bonusSettings) → {Array}

Description:
  • Parse bonus time allowed string to sent data to API

Source:
Parameters:
Name Type Description
bonusSettings Array
Returns:
Type
Array

(static) exports.revertPointsSettingsIntoObject(pointsArray) → {object}

Description:
  • Parse points array into object to sent data to API

Source:
Parameters:
Name Type Description
pointsArray Array
Returns:
Type
object

(static) exports.scrollTo(elementId) → {void}

Description:
  • Scroll to html element

Source:
Parameters:
Name Type Description
elementId string
Returns:
Type
void

(static) exports.weekDayInMonth(month, year) → {number}

Description:
  • Return index of day in week

Source:
Parameters:
Name Type Description
month number
year number
Returns:
Type
number