protected function getInlineJavaScript()
    {
        static $shown = false;

        if (!$shown) {
            $javascript = $this->getInlineJavaScriptTranslations();
            $shown = true;
        } else {
            $javascript = '';
        }

        if (isset($this->valid_range_start)) {
            $start_date = $this->valid_range_start->formatLikeIntl(
                'MM/dd/yyyy'
            );
        } else {
            $start_date = '';
        }

        if (isset($this->valid_range_end)) {
            // JavaScript calendar is inclusive, subtract one second from range
            $tmp = clone $this->valid_range_end;
            $tmp->subtractSeconds(1);
            $end_date = $tmp->formatLikeIntl('MM/dd/yyyy');
        } else {
            $end_date = '';
        }

        $javascript .= sprintf(
            "var %s_obj = new SwatCalendar('%s', '%s', '%s');",
            $this->id,
            $this->id,
            $start_date,
            $end_date
        );

        return $javascript;
    }