@raketa-cloud/admin 1.7.8 → 1.7.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@raketa-cloud/admin",
3
- "version": "1.7.8",
3
+ "version": "1.7.9",
4
4
  "main": "src/index.js",
5
5
  "files": [
6
6
  "src/",
@@ -319,6 +319,9 @@ export default class HonoAdapter {
319
319
  // Build context object
320
320
  const _context = {
321
321
  timezones: i18n.timezones,
322
+ timeLocale: i18n.timeLocale,
323
+ dateTimeFormat: i18n.dateTimeFormat,
324
+ dateFormat: i18n.dateFormat,
322
325
  locales: ctx.locales,
323
326
  locale: ctx.locale,
324
327
  defaultLocale: ctx.defaultLocale,
@@ -143,7 +143,6 @@
143
143
  <%- body %>
144
144
  </div>
145
145
 
146
-
147
146
  <script>
148
147
  const toggleEl = document.getElementById('expand');
149
148
  const sidebarEl = document.getElementById('sidebar');
@@ -163,8 +162,10 @@
163
162
  </script>
164
163
 
165
164
  <script>
166
- // Don't ask
167
165
  const TIMEZONES = JSON.parse("<%= JSON.stringify(_context.timezones) %>".replaceAll("&#34;", '"'))
166
+ const TIME_LOCALE = JSON.parse("<%= JSON.stringify(_context.timeLocale || 'en-GB') %>".replaceAll("&#34;", '"'))
167
+ const TIME_FORMAT = JSON.parse("<%= JSON.stringify(_context.dateTimeFormat || { dateStyle: 'short', timeStyle: 'short' }) %>".replaceAll("&#34;", '"'))
168
+ const DATE_FORMAT = JSON.parse("<%= JSON.stringify(_context.dateFormat || { dateStyle: 'short' }) %>".replaceAll("&#34;", '"'))
168
169
 
169
170
  function enhanceDateTimeInputs(input) {
170
171
  // skew the date so it is like in UTC for the user...
@@ -176,7 +177,7 @@
176
177
  parent.querySelectorAll('[data-auto="1"]').forEach(node => node.remove())
177
178
 
178
179
  // Add user's localtime
179
- const strTime = fakeUTCDate.toLocaleString("en-GB", {});
180
+ const strTime = fakeUTCDate.toLocaleString(TIME_LOCALE, {});
180
181
 
181
182
  const hint = document.createElement("div");
182
183
 
@@ -187,7 +188,7 @@
187
188
  parent.appendChild(hint)
188
189
 
189
190
  TIMEZONES.forEach(timeZone => {
190
- const strTime = fakeUTCDate.toLocaleString("en-GB", {
191
+ const strTime = fakeUTCDate.toLocaleString(TIME_LOCALE, {
191
192
  timeZone: `${timeZone.value}`
192
193
  });
193
194
 
@@ -239,18 +240,13 @@
239
240
  document.querySelectorAll('time[data-pretty-datetime]').forEach(item => {
240
241
  const dateStr = item.getAttribute("datetime");
241
242
 
242
- item.innerText = new Date(dateStr).toLocaleString('en-GB', {
243
- dateStyle: "short",
244
- timeStyle: "short"
245
- })
243
+ item.innerText = new Date(dateStr).toLocaleString(TIME_LOCALE, TIME_FORMAT)
246
244
  })
247
245
 
248
246
  document.querySelectorAll('time[data-pretty-date]').forEach(item => {
249
247
  const dateStr = item.getAttribute("datetime");
250
248
 
251
- item.innerText = new Date(dateStr).toLocaleString('en-GB', {
252
- dateStyle: "short"
253
- })
249
+ item.innerText = new Date(dateStr).toLocaleString(TIME_LOCALE, DATE_FORMAT)
254
250
  })
255
251
 
256
252
  document.querySelectorAll('time[data-pretty-expiration-time]').forEach(item => {
@@ -258,10 +254,7 @@
258
254
 
259
255
  const expTime = new Date(dateStr)
260
256
 
261
- item.innerText = expTime.toLocaleString('en-GB', {
262
- dateStyle: "short",
263
- timeStyle: "short"
264
- })
257
+ item.innerText = expTime.toLocaleString(TIME_LOCALE, TIME_FORMAT)
265
258
 
266
259
  if (new Date() > expTime) {
267
260
  item.style.color = 'red';