Skip to content

Commit

Permalink
fix 解析 timestamp 错误、API 错误
Browse files Browse the repository at this point in the history
  • Loading branch information
ciaoca committed Dec 1, 2021
1 parent 67b1c44 commit e743dc0
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 28 deletions.
56 changes: 30 additions & 26 deletions js/cxcalendar.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*!
* cxCalendar
*
* @version 2.0.2
* @version 2.0.3
* @author ciaoca
* @email [email protected]
* @site https://github.com/ciaoca/cxCalendar
Expand Down Expand Up @@ -206,7 +206,7 @@
attr.i = self.fillLeadZero(date.getMinutes(), 2);
attr.s = self.fillLeadZero(date.getSeconds(), 2);

attr.time = date.getTime();
attr.timestamp = date.getTime();

var str = style;
var keys = ['timestamp','Y','y','m','n','d','j','H','h','G','g','i','s'];
Expand Down Expand Up @@ -1283,30 +1283,34 @@
};

if (typeof callback === 'function') {
callback({
setOptions: function(opts) {
settings = $.extend(settings, opts);
},
show: function() {
cxCalendar.show(input, settings);
},
hide: function() {
cxCalendar.hidePane();
},
getDate: function(style) {
cxCalendar.cacheInput = input;
return cxCalendar.getDate(style);
},
setDate: function(value) {
cxCalendar.cacheInput = input;
cxCalendar.setOptions(settings);
cxCalendar.setDate(value);
},
clearDate: function() {
cxCalendar.cacheInput = input;
cxCalendar.clearDate();
}
});
var api = function(input, settings){
return {
setOptions: function(opts) {
settings = $.extend(settings, opts);
},
show: function() {
cxCalendar.show(input, settings);
},
hide: function() {
cxCalendar.hidePane();
},
getDate: function(style) {
cxCalendar.cacheInput = input;
return cxCalendar.getDate(style);
},
setDate: function(value) {
cxCalendar.cacheInput = input;
cxCalendar.setOptions(settings);
cxCalendar.setDate(value);
},
clearDate: function() {
cxCalendar.cacheInput = input;
cxCalendar.clearDate();
}
};
};

callback(api(input, settings));
};

return this;
Expand Down
Loading

0 comments on commit e743dc0

Please sign in to comment.