날짜 객체를 날짜 문자열로 변환합니다. 이는 서버로 데이터를 전송할 때 유용합니다.
date | Date | 포맷팅이 필요한 날짜 객체 |
var dateToStr = gantt.date.date_to_str("%Y-%m-%d %H:%i");
gantt.templates.format_date = function(date){
return dateToStr(date);
};
자세한 내용은 날짜 형식 지정를 참고하세요.
Gantt는 ISO 날짜 형식을 지원합니다. 이를 사용하려면, 날짜 파싱과 포맷팅을 담당하는 함수를 재정의하면 됩니다:
gantt.templates.parse_date = function(date) {
return new Date(date);
};
gantt.templates.format_date = function(date) {
return date.toISOString();
};
실시간으로 날짜 형식을 변경하려면, parse_date 템플릿도 다음과 같이 업데이트해야 합니다:
var cfg = gantt.config;
var strToDate = gantt.date.str_to_date(cfg.date_format, cfg.server_utc);
gantt.templates.parse_date = function(date){
return strToDate(date);
};