Skip to content

Instantly share code, notes, and snippets.

@tigercosmos
Created May 21, 2018 13:18
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tigercosmos/38356e28d8efcc1ba23e0c8cc593fd08 to your computer and use it in GitHub Desktop.
Save tigercosmos/38356e28d8efcc1ba23e0c8cc593fd08 to your computer and use it in GitHub Desktop.
// .....
} else if (match[DAY_GROUP_1]) { // 處理中文字有關於「天」的部分
var day1 = match[DAY_GROUP_1];
var time1 = match[TIME_GROUP_1];
if (day1 == '明' || day1 == '聽') {
// 如果半夜說明天,通常是今天的概念
if(refMoment.hour() > 1) {
startMoment.add(1, 'day');
}
} else if (day1 == '昨' || day1 == '尋' || day1 == '琴') {
startMoment.add(-1, 'day');
} else if (day1 == "前"){
startMoment.add(-2, 'day');
} else if (day1 == "大前"){
startMoment.add(-3, 'day');
} else if ( day1 == "後"){
startMoment.add(2, 'day');
} else if (day1 == "大後"){
startMoment.add(3, 'day');
}
if (time1 == '早' || time1 == '朝') {
result.start.imply('hour', 6);
} else if (time1 == '晚') {
result.start.imply('hour', 22);
result.start.imply('meridiem', 1);
} else if (match[TIME_GROUP_2]) { // 處理中文字有關於「時」的部分
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment