Skip to content

DateTime

The Luxon library is used for date and time operations.

TIP

You can test working with Date/Time in this example.

ts
import { DateTime } from 'luxon'
import { Text, LoggerBrowser } from '@bitrix24/b24jssdk'

const $logger = LoggerBrowser.build('Test', import.meta.env?.DEV === true)

$logger.info(
	Text.toDateTime('2012-04-12T09:53:51')
	.toFormat('HH:mm:ss y-MM-dd')
) // '09:53:51 2012-04-12' ////

$logger.info(Text.getDateForLog()) // '2012-04-12 09:53:51' ////

$logger.info(
	Text.toDateTime('2012-04-12 14:05:56', 'y-MM-dd HH:mm:ss')
	.toISO()
) // '2012-04-12T14:05:56.000+03:00' ////

Released under the MIT License.