|
@@ -642,6 +642,33 @@ func handleSystemAppointDateT(appointDay, frequency string) (date string, err er
|
|
|
}
|
|
|
}
|
|
|
date = tmpDate.Format(utils.FormatDate)
|
|
|
+ case "本半年":
|
|
|
+ month := currDate.Month()
|
|
|
+ var tmpDate time.Time
|
|
|
+ switch appointDay {
|
|
|
+ case "第一天":
|
|
|
+ if month <= 6 {
|
|
|
+ tmpDate = time.Date(currDate.Year(), 1, 1, 0, 0, 0, 0, currDate.Location())
|
|
|
+ } else {
|
|
|
+ tmpDate = time.Date(currDate.Year(), 7, 1, 0, 0, 0, 0, currDate.Location())
|
|
|
+ }
|
|
|
+ case "最后一天":
|
|
|
+ if month <= 6 {
|
|
|
+ tmpDate = time.Date(currDate.Year(), 6, 30, 0, 0, 0, 0, currDate.Location())
|
|
|
+ } else {
|
|
|
+ tmpDate = time.Date(currDate.Year(), 12, 31, 0, 0, 0, 0, currDate.Location())
|
|
|
+ }
|
|
|
+ }
|
|
|
+ date = tmpDate.Format(utils.FormatDate)
|
|
|
+ case "本年":
|
|
|
+ var tmpDate time.Time
|
|
|
+ switch appointDay {
|
|
|
+ case "第一天":
|
|
|
+ tmpDate = time.Date(currDate.Year(), 1, 1, 0, 0, 0, 0, currDate.Location())
|
|
|
+ case "最后一天":
|
|
|
+ tmpDate = time.Date(currDate.Year(), 12, 31, 0, 0, 0, 0, currDate.Location())
|
|
|
+ }
|
|
|
+ date = tmpDate.Format(utils.FormatDate)
|
|
|
default:
|
|
|
errMsg = "错误的日期频度:" + frequency
|
|
|
err = errors.New(errMsg)
|