Implemented GetProjectIdFromName
This commit is contained in:
parent
b6eefeb0c8
commit
a89d78f66c
1 changed files with 12 additions and 0 deletions
12
z/helpers.go
12
z/helpers.go
|
@ -4,6 +4,7 @@ import (
|
|||
"os/user"
|
||||
"regexp"
|
||||
"strconv"
|
||||
"strings"
|
||||
"time"
|
||||
"math"
|
||||
"errors"
|
||||
|
@ -101,6 +102,17 @@ func ParseTime(timeStr string) (time.Time, error) {
|
|||
}
|
||||
}
|
||||
|
||||
func GetProjectIdFromName(projectName string) string {
|
||||
reg, regerr := regexp.Compile("[^a-zA-Z0-9]+")
|
||||
if regerr != nil {
|
||||
return ""
|
||||
}
|
||||
|
||||
projectId := strings.ToLower(reg.ReplaceAllString(projectName, ""))
|
||||
|
||||
return projectId
|
||||
}
|
||||
|
||||
func GetISOCalendarWeek(date time.Time) (int) {
|
||||
var _, cw = date.ISOWeek()
|
||||
return cw
|
||||
|
|
Loading…
Reference in a new issue