Coding endDate in script

Good. As long as you understand how it works.

One thing you didn't understand: Wiki - how to post code on this forum.