Page Menu
Home
WickedGov Phorge
Search
Configure Global Search
Log In
Files
F4146227
init.js
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Flag For Later
Award Token
Size
1 KB
Referenced Files
None
Subscribers
None
init.js
View Options
// eslint-disable-next-line no-jquery/no-global-selector
$
(
'.ext-nuke-dateTimeField[data-ooui!=""]'
)
.
each
(
(
_index
,
element
)
=>
{
const
field
=
OO
.
ui
.
FieldLayout
.
static
.
infuse
(
$
(
element
)
);
const
input
=
field
.
getField
();
const
moment
=
require
(
'moment'
);
function
validate
()
{
input
.
getValidity
()
.
then
(
()
=>
{
field
.
setErrors
(
[]
);
}
)
.
catch
(
()
=>
{
moment
.
relativeTimeRounding
(
Math
.
floor
);
const
localDay
=
moment
.
utc
().
local
().
format
(
'DD'
);
const
utcDay
=
moment
.
utc
().
format
(
'DD'
);
// we don't need to subtract a day when the utc day is different from local day
// which implies a new day in UTC time and would result in $wgNukeMaxAge - 1
if
(
localDay
!==
utcDay
)
{
field
.
setErrors
(
[
mw
.
msg
(
'nuke-date-limited'
,
moment
()
.
diff
(
input
.
mustBeAfter
.
format
(
'YYYY-MM-DD'
),
'days'
)
)
]
);
}
else
{
field
.
setErrors
(
[
mw
.
msg
(
'nuke-date-limited'
,
moment
()
// `mustBeAfter` is set to always be one day before the `max` in
// DateInputWidget::__construct. We need to remove a day to get
// the original value back.
.
subtract
(
1
,
'day'
)
.
diff
(
input
.
mustBeAfter
.
format
(
'YYYY-MM-DD'
),
'days'
)
)
]
);
}
}
);
}
input
.
on
(
'change'
,
validate
);
validate
();
}
);
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Aug 19 2026, 17:56 (5 w, 5 d ago)
Storage Engine
local-disk
Storage Format
Raw Data
Storage Handle
05/f5/a637510a2edf81b216579f7fa64d
Default Alt Text
init.js (1 KB)
Attached To
Mode
rMWPROD MediaWiki Production
Attached
Detach File
Event Timeline
Log In to Comment