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"
|
"os/user"
|
||||||
"regexp"
|
"regexp"
|
||||||
"strconv"
|
"strconv"
|
||||||
|
"strings"
|
||||||
"time"
|
"time"
|
||||||
"math"
|
"math"
|
||||||
"errors"
|
"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) {
|
func GetISOCalendarWeek(date time.Time) (int) {
|
||||||
var _, cw = date.ISOWeek()
|
var _, cw = date.ISOWeek()
|
||||||
return cw
|
return cw
|
||||||
|
|
Loading…
Reference in a new issue