Skip to content

Commit

Permalink
[fix] date text in week mode
Browse files Browse the repository at this point in the history
  • Loading branch information
netchampfaris committed Feb 2, 2017
1 parent 9bcd2a4 commit 630f840
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 14 deletions.
13 changes: 7 additions & 6 deletions dist/frappe-gantt.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/frappe-gantt.js.map

Large diffs are not rendered by default.

12 changes: 8 additions & 4 deletions src/Gantt.js
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,7 @@ export default function Gantt(element, tasks, config) {

function prepare_dates() {

self.gantt_start = self.gantt_end = null;
for(let task of self.tasks) {
// set global start and end date
if(!self.gantt_start || task._start < self.gantt_start) {
Expand Down Expand Up @@ -400,10 +401,13 @@ export default function Gantt(element, tasks, config) {
'Quarter Day_lower': date.format('HH'),
'Half Day_lower': date.format('HH'),
'Day_lower': date.date() !== last_date.date() ? date.format('D') : '',
'Week_lower': 'Week ' + date.format('W'),
'Week_lower': date.month() !== last_date.month() ?
date.format('D MMM') : date.format('D'),
'Month_lower': date.format('MMMM'),
'Quarter Day_upper': date.date() !== last_date.date() ? date.format('D MMM') : '',
'Half Day_upper': date.date() !== last_date.date() ? date.format('D MMM') : '',
'Half Day_upper': date.date() !== last_date.date() ?
date.month() !== last_date.month() ?
date.format('D MMM') : date.format('D') : '',
'Day_upper': date.month() !== last_date.month() ? date.format('MMMM') : '',
'Week_upper': date.month() !== last_date.month() ? date.format('MMMM') : '',
'Month_upper': date.year() !== last_date.year() ? date.format('YYYY') : ''
Expand All @@ -422,9 +426,9 @@ export default function Gantt(element, tasks, config) {
'Half Day_upper': 0,
'Day_lower': self.config.column_width / 2,
'Day_upper': (self.config.column_width * 30) / 2,
'Week_lower': self.config.column_width / 2,
'Week_lower': 0,
'Week_upper': (self.config.column_width * 4) / 2,
'Month_lower': (date.daysInMonth() * self.config.column_width / 30) / 2,
'Month_lower': self.config.column_width / 2,
'Month_upper': (self.config.column_width * 12) / 2
};

Expand Down
6 changes: 3 additions & 3 deletions src/gantt.scss
Original file line number Diff line number Diff line change
Expand Up @@ -109,14 +109,14 @@ $handle-color: #ddd;
}
}

.primary-text, .secondary-text {
.lower-text, .upper-text {
font-size: 12px;
text-anchor: middle;
}
.primary-text {
.upper-text {
fill: $text-light;
}
.secondary-text {
.lower-text {
fill: $text-color;
}

Expand Down

0 comments on commit 630f840

Please sign in to comment.