Skip to content

Codepen code of date string example

Compare
Choose a tag to compare
@cherifGsoul cherifGsoul released this 18 Jan 21:03
· 51 commits to master since this release

For #30

Fix the codepen example and add can.serialize symbol to DateStringSet type and can.new to DateString type:

class DateStringSet {
	constructor(value){
		this.value = value;
	}
	// used to convert to a number
	valueOf(){
		return new Date(this.value).getTime();
	}
	[Symbol.for("can.serialize")](){
        return this.value;
    }
}

const DateString = {
	[Symbol.for("can.new")]: function(v){ return v; },
	[Symbol.for("can.SetType")]: DateStringSet
};