Exemple #1
0
func (ctx *Context) NewDate() (*Object, error) {
	errVal := ctx.newErrorValue()

	ret := C.JSObjectMakeDate(ctx.ref,
		0, nil,
		&errVal.ref)
	if errVal.ref != nil {
		return nil, errVal
	}
	return ctx.newObject(ret), nil
}
Exemple #2
0
func (ctx *Context) NewDateWithString(date string) (*Object, error) {
	errVal := ctx.newErrorValue()

	param := ctx.NewStringValue(date)

	ret := C.JSObjectMakeDate(ctx.ref,
		C.size_t(1), &param.ref,
		&errVal.ref)
	if errVal.ref != nil {
		return nil, errVal
	}
	return ctx.newObject(ret), nil
}
Exemple #3
0
func (ctx *Context) NewDateWithMilliseconds(milliseconds float64) (*Object, error) {
	errVal := ctx.newErrorValue()

	param := ctx.NewNumberValue(milliseconds)

	ret := C.JSObjectMakeDate(ctx.ref,
		C.size_t(1), &param.ref,
		&errVal.ref)
	if errVal.ref != nil {
		return nil, errVal
	}
	return ctx.newObject(ret), nil
}