Skip to content

Latest commit

History

History

date

Folders and files

NameName
Last commit message
Last commit date

parent directory

..

SWR Audio Lab / Date

Date functions and time helpers.

Install

Add the parent package to your dependencies:

yarn add @swrlab/utils

getDateHourMinutes - get date with hours and minutes

  • value (required) - Date as ISO string

Import the library:

const { getDateHourMinutes } = require('@swrlab/utils/packages/date')

Then use the toolkit:

getDateHourMinutes('2038-01-19T03:14:08.000')
// 'Di, 19. Januar 2038 - 03:14 Uhr'

getDayMonthYear - get date with month and year

  • value (required) - Date as ISO string

Import the library:

const { getDayMonthYear } = require('@swrlab/utils/packages/date')

Then use the toolkit:

getDayMonthYear('2038-01-19T03:14:08.000')
// 'Di, 19. Januar 2038'

getFullRelativeTime - get full date with relative years

  • value (required) - Date as ISO string

Import the library:

const { getFullRelativeTime } = require('@swrlab/utils/packages/date')

Then use the toolkit:

getFullRelativeTime('2038-01-19T03:14:08.000')
// 'Di, 19. Januar 2038 - 03:14 Uhr (in YY Jahren)'

getHourMinutes - get hours and minutes from iso date

  • value (required) - Date as ISO string

Import the library:

const { getHourMinutes } = require('@swrlab/utils/packages/date')

Then use the toolkit:

getHourMinutes('2038-01-19T03:14:08.000')
// '03:14'

getIsoRelativeTime - get iso date with relative years

  • value (required) - Date as ISO string

Import the library:

const { getIsoRelativeTime } = require('@swrlab/utils/packages/date')

Then use the toolkit:

getIsoRelativeTime('2038-01-19T03:14:08.000')
// '2038-01-19T03:14:08.000 (in YY Jahren)'

getRelativeTime - get relative years from iso date

  • value (required) - Date as ISO string

Import the library:

const { getRelativeTime } = require('@swrlab/utils/packages/date')

Then use the toolkit:

getRelativeTime('2038-01-19T03:14:08.000')
// '(in YY Jahren)'

getYearMonthDay - get YYYYMMDD from iso date

  • value (required) - Date as ISO string

Import the library:

const { getYearMonthDay } = require('@swrlab/utils/packages/date')

Then use the toolkit:

getYearMonthDay('2038-01-19T03:14:08.000')
// '20380119'

revYearMonthDay - get DDMMYYYY from YYYYMMDD

  • value (required) - Date as YYYYMMDD string

Import the library:

const { revYearMonthDay } = require('@swrlab/utils/packages/date')

Then use the toolkit:

revYearMonthDay('20380119')
// '19012038'