1 | var isDefined = function(variable) {
|
---|
2 | return !(variable === undefined || variable === null);
|
---|
3 | };
|
---|
4 |
|
---|
5 | function zeropad(n) { return ("0" + n).slice(-2); }
|
---|
6 |
|
---|
7 | Number.prototype.zeropad = function (n) {
|
---|
8 | return (new Array(n + 1).join("0") + this).slice(-n);
|
---|
9 | };
|
---|
10 |
|
---|
11 | var ConvertDate = function (date) {
|
---|
12 | var day = date.getDate().zeropad(2);
|
---|
13 | var month = (1 + date.getMonth()).zeropad(2);
|
---|
14 | var year = date.getFullYear();
|
---|
15 | var hour = (date.getHours() - 2).zeropad(2);
|
---|
16 | var minute = date.getMinutes().zeropad(2);
|
---|
17 | var second = date.getSeconds().zeropad(2);
|
---|
18 | return year + '-' + month + '-' + day + 'T' + hour + ':' + minute + ':' + second + '.000Z';
|
---|
19 | };
|
---|
20 |
|
---|
21 | var ConvertFromDate = function (date) {
|
---|
22 | var day = date.getDate().zeropad(2);
|
---|
23 | var month = (1 + date.getMonth()).zeropad(2);
|
---|
24 | var year = date.getFullYear();
|
---|
25 | return year + '-' + month + '-' + day + 'T00:00:00.000Z';
|
---|
26 | };
|
---|
27 |
|
---|
28 | var ConvertToDate = function (date) {
|
---|
29 | var day = date.getDate().zeropad(2);
|
---|
30 | var month = (1 + date.getMonth()).zeropad(2);
|
---|
31 | var year = date.getFullYear();
|
---|
32 | return year + '-' + month + '-' + day + 'T23:59:59.000Z';
|
---|
33 | };
|
---|
34 |
|
---|
35 |
|
---|
36 | var CSharpDateToString = function (datetime) {
|
---|
37 | var date = new Date(Date.parse(datetime));
|
---|
38 | var day = date.getDate().zeropad(2);
|
---|
39 | var month = (1 + date.getMonth()).zeropad(2);
|
---|
40 | var year = date.getFullYear();
|
---|
41 | var hour = date.getHours().zeropad(2);
|
---|
42 | var minute = date.getMinutes().zeropad(2);
|
---|
43 | var second = date.getSeconds().zeropad(2);
|
---|
44 | return day + '.' + month + '.' + year + ' ' + hour + ':' + minute + ':' + second;
|
---|
45 | };
|
---|
46 |
|
---|
47 | var decryptString = function(s) {
|
---|
48 | return CryptoJS.AES.decrypt(s, "heuristiclab").toString(CryptoJS.enc.Utf8);
|
---|
49 | }; |
---|