How to use the dayjs.default function in dayjs

To help you get started, we’ve selected a few dayjs examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github AnandChowdhary / calendar-link / dist / lib / calendar-link.js View on Github external
CalendarLink.prototype.google = function (event) {
            event = sanitizeEvent(event);
            var startDate = dayjs_1.default(event.start)
                .toISOString()
                .replace(/-/g, '')
                .replace(/:/g, '')
                .replace(/\./g, '');
            var endDate = dayjs_1.default(event.end)
                .toISOString()
                .replace(/-/g, '')
                .replace(/:/g, '')
                .replace(/\./g, '');
            var details = {
                action: 'TEMPLATE',
                text: event.title,
                details: event.description,
                location: event.location,
                trp: event.busy,
                dates: startDate.substring(0, startDate.length - 4) +
                    'Z/' +
                    endDate.substring(0, endDate.length - 4) +
                    'Z'
            };
            if (event.guests && event.guests.length) {
github AnandChowdhary / calendar-link / dist / lib / calendar-link.js View on Github external
function sanitizeEvent(event) {
        event.start = dayjs_1.default(event.start).toDate();
        if (event.duration && event.duration.length && !event.end) {
            var duration = +event.duration[0];
            var unit = event.duration[0];
            event.end = dayjs_1.default(event.start)
                .add(duration, unit)
                .toDate();
        }
        return event;
    }
    var CalendarLink = /** @class */ (function () {
github AnandChowdhary / calendar-link / dist / lib / calendar-link.js View on Github external
CalendarLink.prototype.yahoo = function (event) {
            event = sanitizeEvent(event);
            var details = {
                v: 60,
                title: event.title,
                st: dayjs_1.default(event.start).format('YYYYMMDD[T]HHmmss'),
                et: dayjs_1.default(event.end).format('YYYYMMDD[T]HHmmss'),
                desc: event.description,
                in_loc: event.location
            };
            return 'https://calendar.yahoo.com/' + object_to_querystring_1.default(details);
        };
        return CalendarLink;
github AnandChowdhary / calendar-link / dist / lib / calendar-link.js View on Github external
CalendarLink.prototype.google = function (event) {
            event = sanitizeEvent(event);
            var startDate = dayjs_1.default(event.start)
                .toISOString()
                .replace(/-/g, '')
                .replace(/:/g, '')
                .replace(/\./g, '');
            var endDate = dayjs_1.default(event.end)
                .toISOString()
                .replace(/-/g, '')
                .replace(/:/g, '')
                .replace(/\./g, '');
            var details = {
                action: 'TEMPLATE',
                text: event.title,
                details: event.description,
                location: event.location,
                trp: event.busy,
                dates: startDate.substring(0, startDate.length - 4) +
github AnandChowdhary / calendar-link / dist / lib / calendar-link.js View on Github external
function sanitizeEvent(event) {
        event.start = dayjs_1.default(event.start).toDate();
        if (event.duration && event.duration.length && !event.end) {
            var duration = +event.duration[0];
            var unit = event.duration[0];
            event.end = dayjs_1.default(event.start)
                .add(duration, unit)
                .toDate();
        }
        return event;
    }
    var CalendarLink = /** @class */ (function () {
github AnandChowdhary / calendar-link / dist / lib / calendar-link.js View on Github external
CalendarLink.prototype.yahoo = function (event) {
            event = sanitizeEvent(event);
            var details = {
                v: 60,
                title: event.title,
                st: dayjs_1.default(event.start).format('YYYYMMDD[T]HHmmss'),
                et: dayjs_1.default(event.end).format('YYYYMMDD[T]HHmmss'),
                desc: event.description,
                in_loc: event.location
            };
            return 'https://calendar.yahoo.com/' + object_to_querystring_1.default(details);
        };
        return CalendarLink;

dayjs

2KB immutable date time library alternative to Moment.js with the same modern API

MIT
Latest version published 2 months ago

Package Health Score

88 / 100
Full package analysis