Skip to content

Instantly share code, notes, and snippets.

@Sangrene
Created May 6, 2019 15:27
Show Gist options
  • Save Sangrene/451c1e3ee3b7400a3d5fc9ece9dd2529 to your computer and use it in GitHub Desktop.
Save Sangrene/451c1e3ee3b7400a3d5fc9ece9dd2529 to your computer and use it in GitHub Desktop.
interface ShopModel {
date: string;
}
class Shop extends ShopModel {
constructor(shop: ShopModel){
this.date = shop.date;
}
get formattedDate() {
return moment(this.date).format("DD/MM/YYYY");
}
}
const shop = new Shop({
date: new Date()
});
console.log(shop.formattedDate);
// expected output: "c"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment