Fix borrow over one day will lead to datetime wrong display.

This commit is contained in:
BoHung Chiu 2022-04-09 20:21:02 +08:00
parent 90dabd7560
commit d1b61401cb
3 changed files with 23 additions and 4 deletions

View File

@ -66,8 +66,9 @@ window.date_format = is_chinese ? 'y M d' : 'd M, y';
window.time_format = "h:m b";
window.date_time_str_format = 'y/MM/d H:m';
window.std_date_format = 'y-MM-d';
window.short_day = (is_chinese ? "d (w)" : "w d")
window.short_date = (is_chinese ? "M d (w)" : "w d, M")
window.short_day = (is_chinese ? "d (w)" : "w d");
window.short_date = (is_chinese ? "M d (w)" : "w d, M");
window.short_date_time = (is_chinese ? "M d (w) h:m b" : "w d, M h:m b");
window.getDateString = function(date, format,is_chinese) {
var months = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'];
var week_days = ['Sun','Mon','Tue','Wed','Thu','Fri','Sat'];
@ -302,6 +303,7 @@ var EventDialog = function(calendar,event){
_event.title = _event.event.title;
_event.hiring_person_name = _event.event.extendedProps.hiring_person_name;
_event.error_message = _event.event.extendedProps.error_message;
_event.diff_day = _event.event.extendedProps.diff_day;
if(!_event.hiring_person_name)
_event.hiring_person_name = "";
_event.note = _event.event.extendedProps.note;
@ -680,7 +682,7 @@ var AgendaView = function(calendar){
else
dateFormat = getDateString(s,short_date,is_chinese) + ' - ' + getDateString(e,short_date,is_chinese);
e_t.find("td:first").text(dateFormat);
e_t.find("td.event_time").text((event.allDay ? "All Day" : (getDateString(s, "h:m b")+"~"+getDateString(e, "h:m b"))));
e_t.find("td.event_time").text((event.diff_day ? (getDateString(s, short_date_time,is_chinese)+"~"+getDateString(e, short_date_time, is_chinese)) : (getDateString(s, time_format)+"~"+getDateString(e, time_format))));
e_t.find("div.event").html(event.title).css("color",event.color);
e_t.find("td.Borrower").text(hiring_person_name);
return e_t;

View File

@ -61,7 +61,8 @@ class PHire
:note => self.note_for_hire || "",
:start => startt.to_json.gsub('"',''),
:end => endt.to_json.gsub('"',''),
:allDay => (self.end_time - self.start_time >= 1),
:allDay => false,
:diff_day => (self.end_time - self.start_time >= 1),
:color => (self.passed ? "#3788d8" : "#FC4040"),
:error_message => (self.passed ? nil : "Not approved"),
:s_id=>self.property_day_setting_id.to_s,

View File

@ -9,7 +9,23 @@
.row{
margin-left: 0;
}
.modal-content {
position: relative;
background-color: #fff;
-webkit-background-clip: padding-box;
background-clip: padding-box;
border: 1px solid #999;
border: 1px solid rgba(0,0,0,0.2);
border-radius: 6px;
outline: 0;
-webkit-box-shadow: 0 3px 9px rgb(0 0 0 / 50%);
box-shadow: 0 3px 9px rgb(0 0 0 / 50%);
}
@media (min-width:768px){
.modal-content {
-webkit-box-shadow: 0 5px 15px rgb(0 0 0 / 50%);
box-shadow: 0 5px 15px rgb(0 0 0 / 50%);
}
.col-md-4 > * {
padding: 0 0.5em;
}