mirror of
https://github.com/louislam/uptime-kuma.git
synced 2025-08-10 23:30:07 +08:00
Make two functions to convert ISO 8601 <=> YYYY-MM-DD hh:mm:ss
This commit is contained in:
@@ -103,7 +103,7 @@
|
||||
<div class="my-3">
|
||||
<label class="form-label">{{ $t("DateTime Range") }}</label>
|
||||
<Datepicker
|
||||
v-model="maintenance.dateTimeRange"
|
||||
v-model="maintenance.dateRange"
|
||||
:dark="$root.isDark"
|
||||
range textInput
|
||||
:monthChangeOnScroll="false"
|
||||
@@ -369,8 +369,7 @@ export default {
|
||||
strategy: "single",
|
||||
active: 1,
|
||||
intervalDay: 1,
|
||||
dateTimeRange: [ this.minDate ],
|
||||
dateRange: [],
|
||||
dateRange: [ this.minDate ],
|
||||
timeRange: [{
|
||||
hours: 2,
|
||||
minutes: 0,
|
||||
|
16
src/util.js
16
src/util.js
@@ -7,9 +7,8 @@
|
||||
// Backend uses the compiled file util.js
|
||||
// Frontend uses util.ts
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.parseTimeFromTimeObject = exports.parseTimeObject = exports.getMaintenanceRelativeURL = exports.getMonitorRelativeURL = exports.genSecret = exports.getCryptoRandomInt = exports.getRandomInt = exports.getRandomArbitrary = exports.TimeLogger = exports.polyfill = exports.log = exports.debug = exports.ucfirst = exports.sleep = exports.flipStatus = exports.STATUS_PAGE_MAINTENANCE = exports.STATUS_PAGE_PARTIAL_DOWN = exports.STATUS_PAGE_ALL_UP = exports.STATUS_PAGE_ALL_DOWN = exports.MAINTENANCE = exports.PENDING = exports.UP = exports.DOWN = exports.appName = exports.isDev = void 0;
|
||||
const _dayjs = require("dayjs");
|
||||
const dayjs = _dayjs;
|
||||
exports.utcToISODateTime = exports.isoToUTCDateTime = exports.parseTimeFromTimeObject = exports.parseTimeObject = exports.getMaintenanceRelativeURL = exports.getMonitorRelativeURL = exports.genSecret = exports.getCryptoRandomInt = exports.getRandomInt = exports.getRandomArbitrary = exports.TimeLogger = exports.polyfill = exports.log = exports.debug = exports.ucfirst = exports.sleep = exports.flipStatus = exports.STATUS_PAGE_MAINTENANCE = exports.STATUS_PAGE_PARTIAL_DOWN = exports.STATUS_PAGE_ALL_UP = exports.STATUS_PAGE_ALL_DOWN = exports.MAINTENANCE = exports.PENDING = exports.UP = exports.DOWN = exports.appName = exports.isDev = void 0;
|
||||
const dayjs = require("dayjs");
|
||||
exports.isDev = process.env.NODE_ENV === "development";
|
||||
exports.appName = "Uptime Kuma";
|
||||
exports.DOWN = 0;
|
||||
@@ -351,3 +350,14 @@ function parseTimeFromTimeObject(obj) {
|
||||
return result;
|
||||
}
|
||||
exports.parseTimeFromTimeObject = parseTimeFromTimeObject;
|
||||
function isoToUTCDateTime(input) {
|
||||
return dayjs(input).utc().format("YYYY-MM-DD HH:mm:ss");
|
||||
}
|
||||
exports.isoToUTCDateTime = isoToUTCDateTime;
|
||||
/**
|
||||
* @param input
|
||||
*/
|
||||
function utcToISODateTime(input) {
|
||||
return dayjs.utc(input).toISOString();
|
||||
}
|
||||
exports.utcToISODateTime = utcToISODateTime;
|
||||
|
17
src/util.ts
17
src/util.ts
@@ -6,8 +6,10 @@
|
||||
// Backend uses the compiled file util.js
|
||||
// Frontend uses util.ts
|
||||
|
||||
import * as _dayjs from "dayjs";
|
||||
const dayjs = _dayjs;
|
||||
import * as dayjs from "dayjs";
|
||||
import * as timezone from "dayjs/plugin/timezone";
|
||||
import * as utc from "dayjs/plugin/utc";
|
||||
import {R} from "redbean-node";
|
||||
|
||||
export const isDev = process.env.NODE_ENV === "development";
|
||||
export const appName = "Uptime Kuma";
|
||||
@@ -392,3 +394,14 @@ export function parseTimeFromTimeObject(obj : any) {
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
export function isoToUTCDateTime(input : string) {
|
||||
return dayjs(input).utc().format("YYYY-MM-DD HH:mm:ss");
|
||||
}
|
||||
|
||||
/**
|
||||
* @param input
|
||||
*/
|
||||
export function utcToISODateTime(input : string) {
|
||||
return dayjs.utc(input).toISOString();
|
||||
}
|
||||
|
Reference in New Issue
Block a user