@datenkraft/bb-base-api-ts-client
Version:
The Base API TS Client package enables you to work with other Backbone TS Client packages.
29 lines (28 loc) • 702 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.DateUtil = void 0;
class DateUtil {
}
exports.DateUtil = DateUtil;
DateUtil.convertDayjsToDateString = (date) => {
const timezone = -date.utcOffset();
const pad = (n) => {
n = Math.floor(Math.abs(n));
return (n < 10 ? '0' : '') + n;
};
return (date.year() +
'-' +
pad(date.month() + 1) +
'-' +
pad(date.date()) +
'T' +
pad(date.hour()) +
':' +
pad(date.minute()) +
':' +
pad(date.second()) +
(timezone >= 0 ? '+' : '-') +
pad(timezone / 60) +
':' +
pad(timezone % 60));
};