File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11import $ from 'jquery' ;
2- import { Functions } from './functions.js' ;
32import { CommonParams } from './common.js' ;
43import { ajaxShowMessage } from './ajax-message.js' ;
54import isStorageSupported from './functions/isStorageSupported.js' ;
5+ import formatDateTime from './functions/formatDateTime.js' ;
66
77/**
88 * Functions used in configuration forms and on user preferences pages
@@ -658,10 +658,7 @@ function savePrefsToLocalStorage (form) {
658658 */
659659function updatePrefsDate ( ) {
660660 var d = new Date ( window . localStorage . configMtimeLocal ) ;
661- var msg = window . Messages . strSavedOn . replace (
662- '@DATE@' ,
663- Functions . formatDateTime ( d )
664- ) ;
661+ var msg = window . Messages . strSavedOn . replace ( '@DATE@' , formatDateTime ( d ) ) ;
665662 $ ( '#opts_import_local_storage' ) . find ( 'div.localStorage-exists' ) . html ( msg ) ;
666663}
667664
Original file line number Diff line number Diff line change @@ -3482,28 +3482,6 @@ Functions.onloadLoginForm = () => {
34823482 }
34833483} ;
34843484
3485- /**
3486- * Formats timestamp for display
3487- *
3488- * @param {string } date
3489- * @param {bool } seconds
3490- * @return {string }
3491- */
3492- Functions . formatDateTime = function ( date , seconds ) {
3493- var result = $ . datepicker . formatDate ( 'yy-mm-dd' , date ) ;
3494- var timefmt = 'HH:mm' ;
3495- if ( seconds ) {
3496- timefmt = 'HH:mm:ss' ;
3497- }
3498- return result + ' ' + $ . datepicker . formatTime (
3499- timefmt , {
3500- hour : date . getHours ( ) ,
3501- minute : date . getMinutes ( ) ,
3502- second : date . getSeconds ( )
3503- }
3504- ) ;
3505- } ;
3506-
35073485/**
35083486 * Toggle the Datetimepicker UI if the date value entered
35093487 * by the user in the 'text box' is not going to be accepted
Original file line number Diff line number Diff line change 1+ import $ from 'jquery' ;
2+
3+ /**
4+ * Formats timestamp for display
5+ *
6+ * @param {Date } date
7+ * @param {boolean } seconds
8+ * @return {string }
9+ */
10+ export default function formatDateTime ( date , seconds = false ) {
11+ var result = $ . datepicker . formatDate ( 'yy-mm-dd' , date ) ;
12+ var timefmt = 'HH:mm' ;
13+ if ( seconds ) {
14+ timefmt = 'HH:mm:ss' ;
15+ }
16+ return result + ' ' + $ . datepicker . formatTime (
17+ timefmt , {
18+ hour : date . getHours ( ) ,
19+ minute : date . getMinutes ( ) ,
20+ second : date . getSeconds ( )
21+ }
22+ ) ;
23+ }
You can’t perform that action at this time.
0 commit comments