LLWiki正在建设中,欢迎加入我们

“MediaWiki:Gadget-site-lib.js”的版本间差异

跳转到导航 跳转到搜索
添加935字节 、​ 2021年2月14日 (日) 12:20
无编辑摘要
*/
"use strict";
/*global OO, moment, wgULS*/
window.dispatchEvent( new Event('jquery') );
 
popup.toggle( true ).setFloatableContainer( $this );
}).on('mouseleave blur', target, function() { popup.toggle( false ); });
};
 
/**
* @Function: 更改moment对象的时区
* @Dependencies: moment
* @Parameter: {moment} 原始moment对象
* @Parameter: {String} 符合IANA标准的时区名称或UTC偏移量
* @Return: {moment} 更改时区后的moment对象。注意这不是一个真实存在的时间,只能用于输出,不能用于进一步计算。
* @Return: {String} 以en-us记法表示的时区或UTC偏移量
*/
mw.convertTimezone = function(then, timezone) {
if (isNaN( timezone )) { // 时区名称
const date = new Date(then);
return [ moment(date.toLocaleString('ia', {timeZone: timezone}), 'DD-MM-YYYY HH:mm'),
date.toLocaleString('en-us', {timeZone: timezone, year: '2-digit', timeZoneName: 'short'}).slice(4) ];
} else { // UTC偏移量
return [ moment.utc( then ).add(timezone, 'hour'),
'UTC' + (timezone == '0' ? '' : (timezone > 0 ? '+' : '') + timezone)];
}
};
//</nowiki>
16,874

个编辑

导航菜单