mirror of
https://github.com/elastic/kibana.git
synced 2025-04-24 01:38:56 -04:00
Bits of the timepicker
This commit is contained in:
parent
4a99c4fd85
commit
f86729ebb6
9 changed files with 8197 additions and 21 deletions
31
src/bower_components/moment-timezone/.bower.json
vendored
Normal file
31
src/bower_components/moment-timezone/.bower.json
vendored
Normal file
|
@ -0,0 +1,31 @@
|
|||
{
|
||||
"name": "moment-timezone",
|
||||
"version": "0.0.3",
|
||||
"main": "index.js",
|
||||
"ignore": [
|
||||
"**/.*",
|
||||
"node_modules",
|
||||
"bower_components",
|
||||
"test",
|
||||
"tests",
|
||||
"tasks",
|
||||
"component.json",
|
||||
"composer.json",
|
||||
"CONTRIBUTING.md",
|
||||
"ender.js",
|
||||
"Gruntfile.js",
|
||||
"package.js",
|
||||
"package.json"
|
||||
],
|
||||
"homepage": "https://github.com/moment/moment-timezone",
|
||||
"_release": "0.0.3",
|
||||
"_resolution": {
|
||||
"type": "version",
|
||||
"tag": "0.0.3",
|
||||
"commit": "27a88581c0d44c557d5122cde9946043fa1da94d"
|
||||
},
|
||||
"_source": "git://github.com/moment/moment-timezone.git",
|
||||
"_target": "~0.0.3",
|
||||
"_originalSource": "moment-timezone",
|
||||
"_direct": true
|
||||
}
|
39
src/bower_components/moment-timezone/README.md
vendored
Normal file
39
src/bower_components/moment-timezone/README.md
vendored
Normal file
|
@ -0,0 +1,39 @@
|
|||
moment-timezone
|
||||
===============
|
||||
|
||||
[](https://travis-ci.org/moment/moment-timezone)
|
||||
|
||||
Timezone information for moment.js.
|
||||
|
||||
## After cloning repo
|
||||
|
||||
```
|
||||
git submodule update --init
|
||||
```
|
||||
|
||||
## Updating timezone info
|
||||
|
||||
```
|
||||
git submodule update
|
||||
|
||||
sudo zic tz/africa
|
||||
sudo zic tz/antarctica
|
||||
sudo zic tz/asia
|
||||
sudo zic tz/australasia
|
||||
sudo zic tz/europe
|
||||
sudo zic tz/northamerica
|
||||
sudo zic tz/southamerica
|
||||
|
||||
grunt zdump
|
||||
grunt zones
|
||||
|
||||
grunt test
|
||||
```
|
||||
|
||||
## changelog
|
||||
|
||||
### 0.0.3
|
||||
* added bower support
|
||||
* support newer versions of moment
|
||||
* construction with string and zone respects zone
|
||||
* added more links and timezone names in moment-timezone.json
|
20
src/bower_components/moment-timezone/bower.json
vendored
Normal file
20
src/bower_components/moment-timezone/bower.json
vendored
Normal file
|
@ -0,0 +1,20 @@
|
|||
{
|
||||
"name": "moment-timezone",
|
||||
"version": "0.0.3",
|
||||
"main": "index.js",
|
||||
"ignore": [
|
||||
"**/.*",
|
||||
"node_modules",
|
||||
"bower_components",
|
||||
"test",
|
||||
"tests",
|
||||
"tasks",
|
||||
"component.json",
|
||||
"composer.json",
|
||||
"CONTRIBUTING.md",
|
||||
"ender.js",
|
||||
"Gruntfile.js",
|
||||
"package.js",
|
||||
"package.json"
|
||||
]
|
||||
}
|
2
src/bower_components/moment-timezone/index.js
vendored
Normal file
2
src/bower_components/moment-timezone/index.js
vendored
Normal file
|
@ -0,0 +1,2 @@
|
|||
module.exports = require("./moment-timezone");
|
||||
module.exports.tz.add(require('./moment-timezone.json'));
|
1
src/bower_components/moment-timezone/min/moment-timezone.min.js
vendored
Normal file
1
src/bower_components/moment-timezone/min/moment-timezone.min.js
vendored
Normal file
|
@ -0,0 +1 @@
|
|||
(function(){function t(t){function n(t){t+="";var e=t.split(":"),n=~t.indexOf("-")?-1:1,s=Math.abs(+e[0]),r=parseInt(e[1],10)||0,i=parseInt(e[2],10)||0;return n*(60*s+r+i/60)}function s(t,e,s,r,i,u,a,o,h,f){this.name=t,this.startYear=+e,this.endYear=+s,this.month=+r,this.day=+i,this.dayRule=+u,this.time=n(a),this.timeRule=+o,this.offset=n(h),this.letters=f||""}function r(t,e){this.rule=e,this.start=e.start(t)}function i(t,e){return t.isLast?-1:e.isLast?1:e.start-t.start}function u(t){this.name=t,this.rules=[]}function a(e,s,r,i,u,a){var o,h="string"==typeof u?u.split("_"):[9999];for(this.name=e,this.offset=n(s),this.ruleSet=r,this.letters=i,o=0;h.length>o;o++)h[o]=+h[o];this.until=t.utc(h).subtract("m",n(a))}function o(t,e){return t.until-e.until}function h(t){this.name=d(t),this.displayName=t,this.zones=[]}function f(t){var e,n,s;for(e in t)for(s=t[e],n=0;s.length>n;n++)l(e+" "+s[n])}function l(t){if(Y[t])return Y[t];var e=t.split(/\s/),n=d(e[0]),r=new s(n,e[1],e[2],e[3],e[4],e[5],e[6],e[7],e[8],e[9],e[10]);return Y[t]=r,z(n).add(r),r}function d(t){return(t||"").toLowerCase().replace(/\//g,"_")}function c(t){var e,n,s;for(e in t)for(s=t[e],n=0;s.length>n;n++)p(e+" "+s[n])}function m(t){var e;for(e in t)k[d(e)]=d(t[e])}function p(t){if(M[t])return M[t];var e=t.split(/\s/),n=d(e[0]),s=new a(n,e[1],z(e[2]),e[3],e[4],e[5]);return M[t]=s,y(e[0]).add(s),s}function z(t){return t=d(t),b[t]||(b[t]=new u(t)),b[t]}function y(t){var e=d(t);return k[e]&&(e=k[e]),A[e]||(A[e]=new h(t)),A[e]}function v(t){t&&(t.zones&&c(t.zones),t.rules&&f(t.rules),t.links&&m(t.links))}function R(){var t,e=[];for(t in A)e.push(A[t]);return e}var w,_=t.fn.zoneName,g=t.fn.zoneAbbr,Y={},b={},M={},A={},k={},L=1,N=2,q=7,x=8;return s.prototype={contains:function(t){return t>=this.startYear&&this.endYear>=t},start:function(e){return e=Math.min(Math.max(e,this.startYear),this.endYear),t.utc([e,this.month,this.date(e),0,this.time])},date:function(t){return this.dayRule===q?this.day:this.dayRule===x?this.lastWeekday(t):this.weekdayAfter(t)},weekdayAfter:function(e){for(var n=this.day,s=t([e,this.month,1]).day(),r=this.dayRule+1-s;n>r;)r+=7;return r},lastWeekday:function(e){var n=this.day,s=n%7,r=t([e,this.month+1,1]).day(),i=t([e,this.month,1]).daysInMonth(),u=i+(s-(r-1))-7*~~(n/7);return s>=r&&(u-=7),u}},r.prototype={equals:function(t){return t&&t.rule===this.rule?864e5>Math.abs(t.start-this.start):!1}},u.prototype={add:function(t){this.rules.push(t)},ruleYears:function(t,e){var n,s,u,a=t.year(),o=[];for(n=0;this.rules.length>n;n++)s=this.rules[n],s.contains(a)?o.push(new r(a,s)):s.contains(a+1)&&o.push(new r(a+1,s));return o.push(new r(a-1,this.lastYearRule(a-1))),e&&(u=new r(a-1,e.lastRule()),u.start=e.until.clone().utc(),u.isLast=e.ruleSet!==this,o.push(u)),o.sort(i),o},rule:function(t,e,n){var s,r,i,u,a,o=this.ruleYears(t,n),h=0;for(n&&(r=n.offset+n.lastRule().offset,i=9e4*Math.abs(r)),a=o.length-1;a>-1;a--)u=s,s=o[a],s.equals(u)||(n&&!s.isLast&&i>=Math.abs(s.start-n.until)&&(h+=r-e),s.rule.timeRule===N&&(h=e),s.rule.timeRule!==L&&s.start.add("m",-h),h=s.rule.offset+e);for(a=0;o.length>a;a++)if(s=o[a],t>=s.start&&!s.isLast)return s.rule;return w},lastYearRule:function(t){var e,n,s,r=w,i=-1e30;for(e=0;this.rules.length>e;e++)n=this.rules[e],t>=n.startYear&&(s=n.start(t),s>i&&(i=s,r=n));return r}},a.prototype={rule:function(t,e){return this.ruleSet.rule(t,this.offset,e)},lastRule:function(){return this._lastRule||(this._lastRule=this.rule(this.until)),this._lastRule},format:function(t){return this.letters.replace("%s",t.letters)}},h.prototype={zoneAndRule:function(t){var e,n,s;for(t=t.clone().utc(),e=0;this.zones.length>e&&(n=this.zones[e],!(n.until>t));e++)s=n;return[n,n.rule(t,s)]},add:function(t){this.zones.push(t),this.zones.sort(o)},format:function(t){var e=this.zoneAndRule(t);return e[0].format(e[1])},offset:function(t){var e=this.zoneAndRule(t);return-(e[0].offset+e[1].offset)}},t.updateOffset=function(t){var e;t._z&&(e=t._z.offset(t),16>Math.abs(e)&&(e/=60),t.zone(e))},t.fn.tz=function(e){return e?(this._z=y(e),this._z&&t.updateOffset(this),this):this._z?this._z.displayName:void 0},t.fn.zoneName=function(){return this._z?this._z.format(this):_.call(this)},t.fn.zoneAbbr=function(){return this._z?this._z.format(this):g.call(this)},t.tz=function(){var e,n=[],s=arguments.length-1;for(e=0;s>e;e++)n[e]=arguments[e];var r=t.apply(null,n),i=r.zone();return r.tz(arguments[s]),r.add("minutes",r.zone()-i)},t.tz.add=v,t.tz.addRule=l,t.tz.addZone=p,t.tz.zones=R,t.tz.version=e,w=l("- 0 9999 0 0 0 0 0 0"),t}var e="0.0.3";"function"==typeof define&&define.amd?define("moment-timezone",["moment"],t):"undefined"!=typeof window&&window.moment?t(window.moment):"undefined"!=typeof module&&(module.exports=t(require("moment")))}).apply(this);
|
513
src/bower_components/moment-timezone/moment-timezone.js
vendored
Normal file
513
src/bower_components/moment-timezone/moment-timezone.js
vendored
Normal file
|
@ -0,0 +1,513 @@
|
|||
// moment-timezone.js
|
||||
// version : 0.0.3
|
||||
// author : Tim Wood
|
||||
// license : MIT
|
||||
// github.com/timrwood/moment-timezone
|
||||
|
||||
(function () {
|
||||
|
||||
var VERSION = "0.0.3";
|
||||
|
||||
function onload(moment) {
|
||||
var oldZoneName = moment.fn.zoneName,
|
||||
oldZoneAbbr = moment.fn.zoneAbbr,
|
||||
|
||||
defaultRule,
|
||||
rules = {},
|
||||
ruleSets = {},
|
||||
zones = {},
|
||||
zoneSets = {},
|
||||
links = {},
|
||||
|
||||
TIME_RULE_WALL_CLOCK = 0,
|
||||
TIME_RULE_UTC = 1,
|
||||
TIME_RULE_STANDARD = 2,
|
||||
|
||||
DAY_RULE_DAY_OF_MONTH = 7,
|
||||
DAY_RULE_LAST_WEEKDAY = 8;
|
||||
|
||||
// converts time in the HH:mm:ss format to absolute number of minutes
|
||||
function parseMinutes (input) {
|
||||
input = input + '';
|
||||
var output = input.split(':'),
|
||||
sign = ~input.indexOf('-') ? -1 : 1,
|
||||
hour = Math.abs(+output[0]),
|
||||
minute = parseInt(output[1], 10) || 0,
|
||||
second = parseInt(output[2], 10) || 0;
|
||||
|
||||
return sign * ((hour * 60) + (minute) + (second / 60));
|
||||
}
|
||||
|
||||
/************************************
|
||||
Rules
|
||||
************************************/
|
||||
|
||||
function Rule (name, startYear, endYear, month, day, dayRule, time, timeRule, offset, letters) {
|
||||
this.name = name;
|
||||
this.startYear = +startYear;
|
||||
this.endYear = +endYear;
|
||||
this.month = +month;
|
||||
this.day = +day;
|
||||
this.dayRule = +dayRule;
|
||||
this.time = parseMinutes(time);
|
||||
this.timeRule = +timeRule;
|
||||
this.offset = parseMinutes(offset);
|
||||
this.letters = letters || '';
|
||||
}
|
||||
|
||||
Rule.prototype = {
|
||||
contains : function (year) {
|
||||
return (year >= this.startYear && year <= this.endYear);
|
||||
},
|
||||
|
||||
start : function (year) {
|
||||
year = Math.min(Math.max(year, this.startYear), this.endYear);
|
||||
return moment.utc([year, this.month, this.date(year), 0, this.time]);
|
||||
},
|
||||
|
||||
date : function (year) {
|
||||
if (this.dayRule === DAY_RULE_DAY_OF_MONTH) {
|
||||
return this.day;
|
||||
} else if (this.dayRule === DAY_RULE_LAST_WEEKDAY) {
|
||||
return this.lastWeekday(year);
|
||||
}
|
||||
return this.weekdayAfter(year);
|
||||
},
|
||||
|
||||
weekdayAfter : function (year) {
|
||||
var day = this.day,
|
||||
firstDayOfWeek = moment([year, this.month, 1]).day(),
|
||||
output = this.dayRule + 1 - firstDayOfWeek;
|
||||
|
||||
while (output < day) {
|
||||
output += 7;
|
||||
}
|
||||
|
||||
return output;
|
||||
},
|
||||
|
||||
lastWeekday : function (year) {
|
||||
var day = this.day,
|
||||
dow = day % 7,
|
||||
lastDowOfMonth = moment([year, this.month + 1, 1]).day(),
|
||||
daysInMonth = moment([year, this.month, 1]).daysInMonth(),
|
||||
output = daysInMonth + (dow - (lastDowOfMonth - 1)) - (~~(day / 7) * 7);
|
||||
|
||||
if (dow >= lastDowOfMonth) {
|
||||
output -= 7;
|
||||
}
|
||||
return output;
|
||||
}
|
||||
};
|
||||
|
||||
/************************************
|
||||
Rule Year
|
||||
************************************/
|
||||
|
||||
function RuleYear (year, rule) {
|
||||
this.rule = rule;
|
||||
this.start = rule.start(year);
|
||||
}
|
||||
|
||||
RuleYear.prototype = {
|
||||
equals : function (other) {
|
||||
if (!other || other.rule !== this.rule) {
|
||||
return false;
|
||||
}
|
||||
return Math.abs(other.start - this.start) < 86400000; // 24 * 60 * 60 * 1000
|
||||
}
|
||||
};
|
||||
|
||||
function sortRuleYears (a, b) {
|
||||
if (a.isLast) {
|
||||
return -1;
|
||||
}
|
||||
if (b.isLast) {
|
||||
return 1;
|
||||
}
|
||||
return b.start - a.start;
|
||||
}
|
||||
|
||||
/************************************
|
||||
Rule Sets
|
||||
************************************/
|
||||
|
||||
function RuleSet (name) {
|
||||
this.name = name;
|
||||
this.rules = [];
|
||||
}
|
||||
|
||||
RuleSet.prototype = {
|
||||
add : function (rule) {
|
||||
this.rules.push(rule);
|
||||
},
|
||||
|
||||
ruleYears : function (mom, lastZone) {
|
||||
var i, j,
|
||||
year = mom.year(),
|
||||
rule,
|
||||
lastZoneRule,
|
||||
rules = [];
|
||||
|
||||
for (i = 0; i < this.rules.length; i++) {
|
||||
rule = this.rules[i];
|
||||
if (rule.contains(year)) {
|
||||
rules.push(new RuleYear(year, rule));
|
||||
} else if (rule.contains(year + 1)) {
|
||||
rules.push(new RuleYear(year + 1, rule));
|
||||
}
|
||||
}
|
||||
rules.push(new RuleYear(year - 1, this.lastYearRule(year - 1)));
|
||||
|
||||
if (lastZone) {
|
||||
lastZoneRule = new RuleYear(year - 1, lastZone.lastRule());
|
||||
lastZoneRule.start = lastZone.until.clone().utc();
|
||||
lastZoneRule.isLast = lastZone.ruleSet !== this;
|
||||
rules.push(lastZoneRule);
|
||||
}
|
||||
|
||||
rules.sort(sortRuleYears);
|
||||
return rules;
|
||||
},
|
||||
|
||||
rule : function (mom, offset, lastZone) {
|
||||
var rules = this.ruleYears(mom, lastZone),
|
||||
lastOffset = 0,
|
||||
rule,
|
||||
lastZoneOffset,
|
||||
lastZoneOffsetAbs,
|
||||
lastRule,
|
||||
i;
|
||||
|
||||
if (lastZone) {
|
||||
lastZoneOffset = lastZone.offset + lastZone.lastRule().offset;
|
||||
lastZoneOffsetAbs = Math.abs(lastZoneOffset) * 90000;
|
||||
}
|
||||
|
||||
// make sure to include the previous rule's offset
|
||||
for (i = rules.length - 1; i > -1; i--) {
|
||||
lastRule = rule;
|
||||
rule = rules[i];
|
||||
|
||||
if (rule.equals(lastRule)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (lastZone && !rule.isLast && Math.abs(rule.start - lastZone.until) <= lastZoneOffsetAbs) {
|
||||
lastOffset += lastZoneOffset - offset;
|
||||
}
|
||||
|
||||
if (rule.rule.timeRule === TIME_RULE_STANDARD) {
|
||||
lastOffset = offset;
|
||||
}
|
||||
|
||||
if (rule.rule.timeRule !== TIME_RULE_UTC) {
|
||||
rule.start.add('m', -lastOffset);
|
||||
}
|
||||
|
||||
lastOffset = rule.rule.offset + offset;
|
||||
}
|
||||
|
||||
for (i = 0; i < rules.length; i++) {
|
||||
rule = rules[i];
|
||||
if (mom >= rule.start && !rule.isLast) {
|
||||
return rule.rule;
|
||||
}
|
||||
}
|
||||
|
||||
return defaultRule;
|
||||
},
|
||||
|
||||
lastYearRule : function (year) {
|
||||
var i,
|
||||
rule,
|
||||
start,
|
||||
bestRule = defaultRule,
|
||||
largest = -1e30;
|
||||
|
||||
for (i = 0; i < this.rules.length; i++) {
|
||||
rule = this.rules[i];
|
||||
if (year >= rule.startYear) {
|
||||
start = rule.start(year);
|
||||
if (start > largest) {
|
||||
largest = start;
|
||||
bestRule = rule;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return bestRule;
|
||||
}
|
||||
};
|
||||
|
||||
/************************************
|
||||
Zone
|
||||
************************************/
|
||||
|
||||
function Zone (name, offset, ruleSet, letters, until, untilOffset) {
|
||||
var i,
|
||||
untilArray = typeof until === 'string' ? until.split('_') : [9999];
|
||||
|
||||
this.name = name;
|
||||
this.offset = parseMinutes(offset);
|
||||
this.ruleSet = ruleSet;
|
||||
this.letters = letters;
|
||||
|
||||
for (i = 0; i < untilArray.length; i++) {
|
||||
untilArray[i] = +untilArray[i];
|
||||
}
|
||||
this.until = moment.utc(untilArray).subtract('m', parseMinutes(untilOffset));
|
||||
}
|
||||
|
||||
Zone.prototype = {
|
||||
rule : function (mom, lastZone) {
|
||||
return this.ruleSet.rule(mom, this.offset, lastZone);
|
||||
},
|
||||
|
||||
lastRule : function () {
|
||||
if (!this._lastRule) {
|
||||
this._lastRule = this.rule(this.until);
|
||||
}
|
||||
return this._lastRule;
|
||||
},
|
||||
|
||||
format : function (rule) {
|
||||
return this.letters.replace("%s", rule.letters);
|
||||
}
|
||||
};
|
||||
|
||||
/************************************
|
||||
Zone Set
|
||||
************************************/
|
||||
|
||||
function sortZones (a, b) {
|
||||
return a.until - b.until;
|
||||
}
|
||||
|
||||
function ZoneSet (name) {
|
||||
this.name = normalizeName(name);
|
||||
this.displayName = name;
|
||||
this.zones = [];
|
||||
}
|
||||
|
||||
ZoneSet.prototype = {
|
||||
zoneAndRule : function (mom) {
|
||||
var i,
|
||||
zone,
|
||||
lastZone;
|
||||
|
||||
mom = mom.clone().utc();
|
||||
for (i = 0; i < this.zones.length; i++) {
|
||||
zone = this.zones[i];
|
||||
if (mom < zone.until) {
|
||||
break;
|
||||
}
|
||||
lastZone = zone;
|
||||
}
|
||||
|
||||
return [zone, zone.rule(mom, lastZone)];
|
||||
},
|
||||
|
||||
add : function (zone) {
|
||||
this.zones.push(zone);
|
||||
this.zones.sort(sortZones);
|
||||
},
|
||||
|
||||
format : function (mom) {
|
||||
var zoneAndRule = this.zoneAndRule(mom);
|
||||
return zoneAndRule[0].format(zoneAndRule[1]);
|
||||
},
|
||||
|
||||
offset : function (mom) {
|
||||
var zoneAndRule = this.zoneAndRule(mom);
|
||||
return -(zoneAndRule[0].offset + zoneAndRule[1].offset);
|
||||
}
|
||||
};
|
||||
|
||||
/************************************
|
||||
Global Methods
|
||||
************************************/
|
||||
|
||||
function addRules (rules) {
|
||||
var i, j, rule;
|
||||
for (i in rules) {
|
||||
rule = rules[i];
|
||||
for (j = 0; j < rule.length; j++) {
|
||||
addRule(i + '\t' + rule[j]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function addRule (ruleString) {
|
||||
// don't duplicate rules
|
||||
if (rules[ruleString]) {
|
||||
return rules[ruleString];
|
||||
}
|
||||
|
||||
var p = ruleString.split(/\s/),
|
||||
name = normalizeName(p[0]),
|
||||
rule = new Rule(name, p[1], p[2], p[3], p[4], p[5], p[6], p[7], p[8], p[9], p[10]);
|
||||
|
||||
// cache the rule so we don't add it again
|
||||
rules[ruleString] = rule;
|
||||
|
||||
// add to the ruleset
|
||||
getRuleSet(name).add(rule);
|
||||
|
||||
return rule;
|
||||
}
|
||||
|
||||
function normalizeName (name) {
|
||||
return (name || '').toLowerCase().replace(/\//g, '_');
|
||||
}
|
||||
|
||||
function addZones (zones) {
|
||||
var i, j, zone;
|
||||
for (i in zones) {
|
||||
zone = zones[i];
|
||||
for (j = 0; j < zone.length; j++) {
|
||||
addZone(i + '\t' + zone[j]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function addLinks (linksToAdd) {
|
||||
var i;
|
||||
for (i in linksToAdd) {
|
||||
links[normalizeName(i)] = normalizeName(linksToAdd[i]);
|
||||
}
|
||||
}
|
||||
|
||||
function addZone (zoneString) {
|
||||
// don't duplicate zones
|
||||
if (zones[zoneString]) {
|
||||
return zones[zoneString];
|
||||
}
|
||||
|
||||
var p = zoneString.split(/\s/),
|
||||
name = normalizeName(p[0]),
|
||||
zone = new Zone(name, p[1], getRuleSet(p[2]), p[3], p[4], p[5]);
|
||||
|
||||
// cache the zone so we don't add it again
|
||||
zones[zoneString] = zone;
|
||||
|
||||
// add to the zoneset
|
||||
getZoneSet(p[0]).add(zone);
|
||||
|
||||
return zone;
|
||||
}
|
||||
|
||||
function getRuleSet (name) {
|
||||
name = normalizeName(name);
|
||||
if (!ruleSets[name]) {
|
||||
ruleSets[name] = new RuleSet(name);
|
||||
}
|
||||
return ruleSets[name];
|
||||
}
|
||||
|
||||
function getZoneSet (name) {
|
||||
var machineName = normalizeName(name);
|
||||
if (links[machineName]) {
|
||||
machineName = links[machineName];
|
||||
}
|
||||
if (!zoneSets[machineName]) {
|
||||
zoneSets[machineName] = new ZoneSet(name);
|
||||
}
|
||||
return zoneSets[machineName];
|
||||
}
|
||||
|
||||
function add (data) {
|
||||
if (!data) {
|
||||
return;
|
||||
}
|
||||
if (data.zones) {
|
||||
addZones(data.zones);
|
||||
}
|
||||
if (data.rules) {
|
||||
addRules(data.rules);
|
||||
}
|
||||
if (data.links) {
|
||||
addLinks(data.links);
|
||||
}
|
||||
}
|
||||
|
||||
// overwrite moment.updateOffset
|
||||
moment.updateOffset = function (mom) {
|
||||
var offset;
|
||||
if (mom._z) {
|
||||
offset = mom._z.offset(mom);
|
||||
if (Math.abs(offset) < 16) {
|
||||
offset = offset / 60;
|
||||
}
|
||||
mom.zone(offset);
|
||||
}
|
||||
};
|
||||
|
||||
function getZoneSets() {
|
||||
var sets = [],
|
||||
zoneName;
|
||||
for (zoneName in zoneSets) {
|
||||
sets.push(zoneSets[zoneName]);
|
||||
}
|
||||
return sets;
|
||||
}
|
||||
|
||||
moment.fn.tz = function (name) {
|
||||
if (name) {
|
||||
this._z = getZoneSet(name);
|
||||
if (this._z) {
|
||||
moment.updateOffset(this);
|
||||
}
|
||||
return this;
|
||||
}
|
||||
if (this._z) {
|
||||
return this._z.displayName;
|
||||
}
|
||||
};
|
||||
|
||||
moment.fn.zoneName = function () {
|
||||
if (this._z) {
|
||||
return this._z.format(this);
|
||||
}
|
||||
return oldZoneName.call(this);
|
||||
};
|
||||
|
||||
moment.fn.zoneAbbr = function () {
|
||||
if (this._z) {
|
||||
return this._z.format(this);
|
||||
}
|
||||
return oldZoneAbbr.call(this);
|
||||
};
|
||||
|
||||
moment.tz = function () {
|
||||
var args = [], i, len = arguments.length - 1;
|
||||
for (i = 0; i < len; i++) {
|
||||
args[i] = arguments[i];
|
||||
}
|
||||
var m = moment.apply(null, args);
|
||||
var preTzOffset = m.zone();
|
||||
m.tz(arguments[len]);
|
||||
return m.add('minutes', m.zone() - preTzOffset);
|
||||
};
|
||||
|
||||
moment.tz.add = add;
|
||||
moment.tz.addRule = addRule;
|
||||
moment.tz.addZone = addZone;
|
||||
moment.tz.zones = getZoneSets;
|
||||
|
||||
moment.tz.version = VERSION;
|
||||
|
||||
// add default rule
|
||||
defaultRule = addRule("- 0 9999 0 0 0 0 0 0");
|
||||
|
||||
return moment;
|
||||
}
|
||||
|
||||
if (typeof define === "function" && define.amd) {
|
||||
define("moment-timezone", ["moment"], onload);
|
||||
} else if (typeof window !== "undefined" && window.moment) {
|
||||
onload(window.moment);
|
||||
} else if (typeof module !== 'undefined') {
|
||||
module.exports = onload(require('moment'));
|
||||
}
|
||||
}).apply(this);
|
7564
src/bower_components/moment-timezone/moment-timezone.json
vendored
Normal file
7564
src/bower_components/moment-timezone/moment-timezone.json
vendored
Normal file
File diff suppressed because it is too large
Load diff
|
@ -2,6 +2,7 @@ define(function (require) {
|
|||
var _ = require('utils/mixins');
|
||||
|
||||
var settingsHtml = require('text!../partials/settings.html');
|
||||
var timepickerHtml = require('text!partials/timepicker.html');
|
||||
|
||||
var app = require('modules').get('app/discover');
|
||||
|
||||
|
@ -100,6 +101,15 @@ define(function (require) {
|
|||
}
|
||||
};
|
||||
|
||||
$scope.toggleTimepicker = function () {
|
||||
// Close if already open
|
||||
if ($scope.configTemplate === timepickerHtml) {
|
||||
delete $scope.configTemplate;
|
||||
} else {
|
||||
$scope.configTemplate = timepickerHtml;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
$scope.fetch = function () {
|
||||
if (!$scope.fields) getFields();
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
<div class="kbn-timepicker container-fluid">
|
||||
|
||||
<div class="kbn-timepicker">
|
||||
<style>
|
||||
.kbn-timepicker [kbn-time-input] {
|
||||
text-align: center;
|
||||
|
@ -7,24 +6,21 @@
|
|||
</style>
|
||||
|
||||
<div class="row">
|
||||
<form name="input">
|
||||
<div class="timepicker-from col-xs-6 col-md-3">
|
||||
<center>
|
||||
<div ng-model="from">
|
||||
<datepicker max="to" show-weeks="false"></datepicker>
|
||||
</div>
|
||||
<br>
|
||||
</center>
|
||||
</div>
|
||||
|
||||
<div class="timepicker-from col-xs-6 col-md-3">
|
||||
<center>
|
||||
<div ng-model="from">
|
||||
<datepicker max="to" show-weeks="false"></datepicker>
|
||||
</div>
|
||||
<br>
|
||||
</center>
|
||||
</div>
|
||||
|
||||
<div class="timepicker-from col-xs-6 col-md-3">
|
||||
<center>
|
||||
<div ng-model="to">
|
||||
<datepicker min="from" show-weeks="false"></datepicker>
|
||||
</div>
|
||||
</center>
|
||||
</div>
|
||||
|
||||
</form>
|
||||
<div class="timepicker-from col-xs-6 col-md-3">
|
||||
<center>
|
||||
<div ng-model="to">
|
||||
<datepicker min="from" show-weeks="false"></datepicker>
|
||||
</div>
|
||||
</center>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
Loading…
Add table
Add a link
Reference in a new issue