We are currently solving the following issue within our repository. Here is the issue text:
--- BEGIN ISSUE ---
Default option for DateTimeParameter
## Current behavior
You can set a default value for a `Parameter`, ie:
```
my_param = Parameter('my_param', default=None)
my_other_param = Parameter('my_other_param', default='hi')
```
but not for a `DateTimeParameter`. If nothing is supplied by the user, it will default to `None` if it's optional (`required = False`), and will raise an error if `required = True`.

When a DateTimeParameter is in a flow, it's likely that there's code later in the flow which operates on this date (eg. adding days) and which expect `DateTime` objects. Some of these operations raise errors when they're provided with a `NoneType` object. This means that if a `DateTimeParameter` is optional, it is likely to result in errors downstream. This means that we need to supply a value for all DateTimeParameters each time we run the flow (this gets cumbersome if we are testing and triggering repeated runs through the UI with the same DateTimeParameters each time).

## Proposed behavior
It would be awesome if we can set default values for `DateTimeParameter`s too which mirrors the behaviour of the defaults on `Parameter`. That is, if a `DateTimeParameter` is optional but we have provided a default, the flow can still run using this default value rather than raising an error or needing to supply values each time we run a flow. Currently, we would have to handle the `None` case when it's required (eg. `if date is None then date=...`), but this is effectively the same as setting a default. It would be better and more readable if the default was attached to the `DateTimeParameter` argument upfront.

To stay consistent with the behaviour of `Parameter`, if a `DateTimeParameter` is required and a default is provided, it will still raise a 'no parameter received' error if nothing is supplied by the user.

Ideally we could pass through a `Date` or `DateTime` object, but a string would suffice too, if JSON-serializable requirements get in the way.

## Example
```
# Ideal
from pendulum import DateTime
my_date = DateTimeParameter('my_date', default=DateTime(2020, 9, 1))
# Admitting a string would be ok too
my_other_date = DateTimeParameter('my_other_date', default='2021-01-01T00:00:00+00:00')
```


--- END ISSUE ---

Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
--- BEGIN FILES ---
Path: `src/prefect/core/parameter.py`
Content:
```
1 from typing import TYPE_CHECKING, Any, Dict, Iterable, Union, Optional
2 
3 import pendulum
4 
5 import prefect
6 from prefect.engine.serializers import DateTimeSerializer
7 import prefect.engine.signals
8 import prefect.triggers
9 from prefect.core.task import Task, NoDefault
10 from prefect.engine.results import PrefectResult
11 
12 if TYPE_CHECKING:
13     from prefect.core.flow import Flow  # pylint: disable=W0611
14 
15 
16 no_default = NoDefault.value
17 
18 JSONSerializableParameterValue = Optional[
19     Union[NoDefault, str, int, float, bool, list, dict]
20 ]
21 
22 
23 class Parameter(Task):
24     """
25     A Parameter is a special task that defines a required flow input.
26 
27     A parameter's "slug" is automatically -- and immutably -- set to the parameter name.
28     Flows enforce slug uniqueness across all tasks, so this ensures that the flow has
29     no other parameters by the same name.
30 
31     Args:
32         - name (str): the Parameter name.
33         - default (any, optional): A default value for the parameter. Must be a JSON-Serializable type.
34         - required (bool, optional): If True, the Parameter is required and the
35             default value is ignored. Defaults to `False` if a `default` is
36             provided, otherwise `True`.
37         - tags ([str], optional): A list of tags for this parameter
38 
39     """
40 
41     def __init__(
42         self,
43         name: str,
44         default: JSONSerializableParameterValue = no_default,
45         required: bool = None,
46         tags: Iterable[str] = None,
47     ):
48         if required is None:
49             required = default is no_default
50         if default is no_default:
51             default = None
52         self.required = required
53         self.default = default
54 
55         super().__init__(
56             name=name, slug=name, tags=tags, result=PrefectResult(), checkpoint=True
57         )
58 
59     def __repr__(self) -> str:
60         return "<Parameter: {self.name}>".format(self=self)
61 
62     def __call__(self, flow: "Flow" = None) -> "Parameter":  # type: ignore
63         """
64         Calling a Parameter adds it to a flow.
65 
66         Args:
67             - flow (Flow, optional): The flow to set dependencies on, defaults to the current
68                 flow in context if no flow is specified
69 
70         Returns:
71             - Task: a new Task instance
72 
73         """
74         result = super().bind(flow=flow)
75         assert isinstance(result, Parameter)  # mypy assert
76         return result
77 
78     def copy(self, name: str, **task_args: Any) -> "Task":  # type: ignore
79         """
80         Creates a copy of the Parameter with a new name.
81 
82         Args:
83             - name (str): the new Parameter name
84             - **task_args (dict, optional): a dictionary of task attribute keyword arguments,
85                 these attributes will be set on the new copy
86 
87         Raises:
88             - AttributeError: if any passed `task_args` are not attributes of the original
89 
90         Returns:
91             - Parameter: a copy of the current Parameter, with a new name and any attributes
92                 updated from `task_args`
93         """
94         return super().copy(name=name, slug=name, **task_args)
95 
96     def run(self) -> Any:
97         params = prefect.context.get("parameters") or {}
98         if self.required and self.name not in params:
99             self.logger.debug(
100                 'Parameter "{}" was required but not provided.'.format(self.name)
101             )
102             raise prefect.engine.signals.FAIL(
103                 'Parameter "{}" was required but not provided.'.format(self.name)
104             )
105         return params.get(self.name, self.default)
106 
107     # Serialization ------------------------------------------------------------
108 
109     def serialize(self) -> Dict[str, Any]:
110         """
111         Creates a serialized representation of this parameter
112 
113         Returns:
114             - dict representing this parameter
115         """
116         return prefect.serialization.task.ParameterSchema().dump(self)
117 
118 
119 class DateTimeParameter(Parameter):
120     """
121     A DateTimeParameter that casts its input as a DateTime
122 
123     Args:
124         - name (str): the Parameter name.
125         - required (bool, optional): If True, the Parameter is required. Otherwise, it
126             is optional and will return `None` if no value is provided.
127         - tags ([str], optional): A list of tags for this parameter
128     """
129 
130     def __init__(
131         self,
132         name: str,
133         required: bool = True,
134         tags: Iterable[str] = None,
135     ) -> None:
136         default = no_default if required else None
137         super().__init__(name=name, default=default, required=required, tags=tags)
138         self.result = PrefectResult(serializer=DateTimeSerializer())
139 
140     def run(self) -> Any:
141         value = super().run()
142         if value is None:
143             return value
144         elif isinstance(value, str):
145             return pendulum.parse(value)
146         else:
147             return pendulum.instance(value)
148
```
--- END FILES ---

Please first localize the bug based on the issue statement, and then generate a patch according to the `git diff` format fenced by three backticks.

Here is an example:

```diff
diff --git a/examples/server_async.py b/examples/server_async.py
--- a/examples/server_async.py
+++ b/examples/server_async.py
@@ -313,4 +313,4 @@
 
 
 if __name__ == "__main__":
-    asyncio.run(run_async_server("."), debug=True)
+    asyncio.run(run_async_server(), debug=True)
diff --git a/examples/server_sync.py b/examples/server_sync.py
--- a/examples/server_sync.py
+++ b/examples/server_sync.py
@@ -313,5 +313,5 @@
 
 
 if __name__ == "__main__":
-    server = run_sync_server(".")
+    server = run_sync_server()
     server.shutdown()

```

diff --git a/src/prefect/core/parameter.py b/src/prefect/core/parameter.py
--- a/src/prefect/core/parameter.py
+++ b/src/prefect/core/parameter.py
@@ -122,6 +122,8 @@
 
     Args:
         - name (str): the Parameter name.
+        - default (any, optional): A default value for the parameter. Must be a JSON-Serializable type,
+            and must be parseable by pendulum.
         - required (bool, optional): If True, the Parameter is required. Otherwise, it
             is optional and will return `None` if no value is provided.
         - tags ([str], optional): A list of tags for this parameter
@@ -130,10 +132,10 @@
     def __init__(
         self,
         name: str,
+        default: JSONSerializableParameterValue = no_default,
         required: bool = True,
         tags: Iterable[str] = None,
     ) -> None:
-        default = no_default if required else None
         super().__init__(name=name, default=default, required=required, tags=tags)
         self.result = PrefectResult(serializer=DateTimeSerializer())

{"golden_diff": "diff --git a/src/prefect/core/parameter.py b/src/prefect/core/parameter.py\n--- a/src/prefect/core/parameter.py\n+++ b/src/prefect/core/parameter.py\n@@ -122,6 +122,8 @@\n \n     Args:\n         - name (str): the Parameter name.\n+        - default (any, optional): A default value for the parameter. Must be a JSON-Serializable type,\n+            and must be parseable by pendulum.\n         - required (bool, optional): If True, the Parameter is required. Otherwise, it\n             is optional and will return `None` if no value is provided.\n         - tags ([str], optional): A list of tags for this parameter\n@@ -130,10 +132,10 @@\n     def __init__(\n         self,\n         name: str,\n+        default: JSONSerializableParameterValue = no_default,\n         required: bool = True,\n         tags: Iterable[str] = None,\n     ) -> None:\n-        default = no_default if required else None\n         super().__init__(name=name, default=default, required=required, tags=tags)\n         self.result = PrefectResult(serializer=DateTimeSerializer())\n", "issue": "Default option for DateTimeParameter\n## Current behavior\r\nYou can set a default value for a `Parameter`, ie:\r\n```\r\nmy_param = Parameter('my_param', default=None)\r\nmy_other_param = Parameter('my_other_param', default='hi')\r\n```\r\nbut not for a `DateTimeParameter`. If nothing is supplied by the user, it will default to `None` if it's optional (`required = False`), and will raise an error if `required = True`.\r\n\r\nWhen a DateTimeParameter is in a flow, it's likely that there's code later in the flow which operates on this date (eg. adding days) and which expect `DateTime` objects. Some of these operations raise errors when they're provided with a `NoneType` object. This means that if a `DateTimeParameter` is optional, it is likely to result in errors downstream. This means that we need to supply a value for all DateTimeParameters each time we run the flow (this gets cumbersome if we are testing and triggering repeated runs through the UI with the same DateTimeParameters each time).\r\n\r\n## Proposed behavior\r\nIt would be awesome if we can set default values for `DateTimeParameter`s too which mirrors the behaviour of the defaults on `Parameter`. That is, if a `DateTimeParameter` is optional but we have provided a default, the flow can still run using this default value rather than raising an error or needing to supply values each time we run a flow. Currently, we would have to handle the `None` case when it's required (eg. `if date is None then date=...`), but this is effectively the same as setting a default. It would be better and more readable if the default was attached to the `DateTimeParameter` argument upfront.\r\n\r\nTo stay consistent with the behaviour of `Parameter`, if a `DateTimeParameter` is required and a default is provided, it will still raise a 'no parameter received' error if nothing is supplied by the user.\r\n\r\nIdeally we could pass through a `Date` or `DateTime` object, but a string would suffice too, if JSON-serializable requirements get in the way.\r\n\r\n## Example\r\n```\r\n# Ideal\r\nfrom pendulum import DateTime\r\nmy_date = DateTimeParameter('my_date', default=DateTime(2020, 9, 1))\r\n# Admitting a string would be ok too\r\nmy_other_date = DateTimeParameter('my_other_date', default='2021-01-01T00:00:00+00:00')\r\n```\r\n\n", "before_files": [{"content": "from typing import TYPE_CHECKING, Any, Dict, Iterable, Union, Optional\n\nimport pendulum\n\nimport prefect\nfrom prefect.engine.serializers import DateTimeSerializer\nimport prefect.engine.signals\nimport prefect.triggers\nfrom prefect.core.task import Task, NoDefault\nfrom prefect.engine.results import PrefectResult\n\nif TYPE_CHECKING:\n    from prefect.core.flow import Flow  # pylint: disable=W0611\n\n\nno_default = NoDefault.value\n\nJSONSerializableParameterValue = Optional[\n    Union[NoDefault, str, int, float, bool, list, dict]\n]\n\n\nclass Parameter(Task):\n    \"\"\"\n    A Parameter is a special task that defines a required flow input.\n\n    A parameter's \"slug\" is automatically -- and immutably -- set to the parameter name.\n    Flows enforce slug uniqueness across all tasks, so this ensures that the flow has\n    no other parameters by the same name.\n\n    Args:\n        - name (str): the Parameter name.\n        - default (any, optional): A default value for the parameter. Must be a JSON-Serializable type.\n        - required (bool, optional): If True, the Parameter is required and the\n            default value is ignored. Defaults to `False` if a `default` is\n            provided, otherwise `True`.\n        - tags ([str], optional): A list of tags for this parameter\n\n    \"\"\"\n\n    def __init__(\n        self,\n        name: str,\n        default: JSONSerializableParameterValue = no_default,\n        required: bool = None,\n        tags: Iterable[str] = None,\n    ):\n        if required is None:\n            required = default is no_default\n        if default is no_default:\n            default = None\n        self.required = required\n        self.default = default\n\n        super().__init__(\n            name=name, slug=name, tags=tags, result=PrefectResult(), checkpoint=True\n        )\n\n    def __repr__(self) -> str:\n        return \"<Parameter: {self.name}>\".format(self=self)\n\n    def __call__(self, flow: \"Flow\" = None) -> \"Parameter\":  # type: ignore\n        \"\"\"\n        Calling a Parameter adds it to a flow.\n\n        Args:\n            - flow (Flow, optional): The flow to set dependencies on, defaults to the current\n                flow in context if no flow is specified\n\n        Returns:\n            - Task: a new Task instance\n\n        \"\"\"\n        result = super().bind(flow=flow)\n        assert isinstance(result, Parameter)  # mypy assert\n        return result\n\n    def copy(self, name: str, **task_args: Any) -> \"Task\":  # type: ignore\n        \"\"\"\n        Creates a copy of the Parameter with a new name.\n\n        Args:\n            - name (str): the new Parameter name\n            - **task_args (dict, optional): a dictionary of task attribute keyword arguments,\n                these attributes will be set on the new copy\n\n        Raises:\n            - AttributeError: if any passed `task_args` are not attributes of the original\n\n        Returns:\n            - Parameter: a copy of the current Parameter, with a new name and any attributes\n                updated from `task_args`\n        \"\"\"\n        return super().copy(name=name, slug=name, **task_args)\n\n    def run(self) -> Any:\n        params = prefect.context.get(\"parameters\") or {}\n        if self.required and self.name not in params:\n            self.logger.debug(\n                'Parameter \"{}\" was required but not provided.'.format(self.name)\n            )\n            raise prefect.engine.signals.FAIL(\n                'Parameter \"{}\" was required but not provided.'.format(self.name)\n            )\n        return params.get(self.name, self.default)\n\n    # Serialization ------------------------------------------------------------\n\n    def serialize(self) -> Dict[str, Any]:\n        \"\"\"\n        Creates a serialized representation of this parameter\n\n        Returns:\n            - dict representing this parameter\n        \"\"\"\n        return prefect.serialization.task.ParameterSchema().dump(self)\n\n\nclass DateTimeParameter(Parameter):\n    \"\"\"\n    A DateTimeParameter that casts its input as a DateTime\n\n    Args:\n        - name (str): the Parameter name.\n        - required (bool, optional): If True, the Parameter is required. Otherwise, it\n            is optional and will return `None` if no value is provided.\n        - tags ([str], optional): A list of tags for this parameter\n    \"\"\"\n\n    def __init__(\n        self,\n        name: str,\n        required: bool = True,\n        tags: Iterable[str] = None,\n    ) -> None:\n        default = no_default if required else None\n        super().__init__(name=name, default=default, required=required, tags=tags)\n        self.result = PrefectResult(serializer=DateTimeSerializer())\n\n    def run(self) -> Any:\n        value = super().run()\n        if value is None:\n            return value\n        elif isinstance(value, str):\n            return pendulum.parse(value)\n        else:\n            return pendulum.instance(value)\n", "path": "src/prefect/core/parameter.py"}], "after_files": [{"content": "from typing import TYPE_CHECKING, Any, Dict, Iterable, Union, Optional\n\nimport pendulum\n\nimport prefect\nfrom prefect.engine.serializers import DateTimeSerializer\nimport prefect.engine.signals\nimport prefect.triggers\nfrom prefect.core.task import Task, NoDefault\nfrom prefect.engine.results import PrefectResult\n\nif TYPE_CHECKING:\n    from prefect.core.flow import Flow  # pylint: disable=W0611\n\n\nno_default = NoDefault.value\n\nJSONSerializableParameterValue = Optional[\n    Union[NoDefault, str, int, float, bool, list, dict]\n]\n\n\nclass Parameter(Task):\n    \"\"\"\n    A Parameter is a special task that defines a required flow input.\n\n    A parameter's \"slug\" is automatically -- and immutably -- set to the parameter name.\n    Flows enforce slug uniqueness across all tasks, so this ensures that the flow has\n    no other parameters by the same name.\n\n    Args:\n        - name (str): the Parameter name.\n        - default (any, optional): A default value for the parameter. Must be a JSON-Serializable type.\n        - required (bool, optional): If True, the Parameter is required and the\n            default value is ignored. Defaults to `False` if a `default` is\n            provided, otherwise `True`.\n        - tags ([str], optional): A list of tags for this parameter\n\n    \"\"\"\n\n    def __init__(\n        self,\n        name: str,\n        default: JSONSerializableParameterValue = no_default,\n        required: bool = None,\n        tags: Iterable[str] = None,\n    ):\n        if required is None:\n            required = default is no_default\n        if default is no_default:\n            default = None\n        self.required = required\n        self.default = default\n\n        super().__init__(\n            name=name, slug=name, tags=tags, result=PrefectResult(), checkpoint=True\n        )\n\n    def __repr__(self) -> str:\n        return \"<Parameter: {self.name}>\".format(self=self)\n\n    def __call__(self, flow: \"Flow\" = None) -> \"Parameter\":  # type: ignore\n        \"\"\"\n        Calling a Parameter adds it to a flow.\n\n        Args:\n            - flow (Flow, optional): The flow to set dependencies on, defaults to the current\n                flow in context if no flow is specified\n\n        Returns:\n            - Task: a new Task instance\n\n        \"\"\"\n        result = super().bind(flow=flow)\n        assert isinstance(result, Parameter)  # mypy assert\n        return result\n\n    def copy(self, name: str, **task_args: Any) -> \"Task\":  # type: ignore\n        \"\"\"\n        Creates a copy of the Parameter with a new name.\n\n        Args:\n            - name (str): the new Parameter name\n            - **task_args (dict, optional): a dictionary of task attribute keyword arguments,\n                these attributes will be set on the new copy\n\n        Raises:\n            - AttributeError: if any passed `task_args` are not attributes of the original\n\n        Returns:\n            - Parameter: a copy of the current Parameter, with a new name and any attributes\n                updated from `task_args`\n        \"\"\"\n        return super().copy(name=name, slug=name, **task_args)\n\n    def run(self) -> Any:\n        params = prefect.context.get(\"parameters\") or {}\n        if self.required and self.name not in params:\n            self.logger.debug(\n                'Parameter \"{}\" was required but not provided.'.format(self.name)\n            )\n            raise prefect.engine.signals.FAIL(\n                'Parameter \"{}\" was required but not provided.'.format(self.name)\n            )\n        return params.get(self.name, self.default)\n\n    # Serialization ------------------------------------------------------------\n\n    def serialize(self) -> Dict[str, Any]:\n        \"\"\"\n        Creates a serialized representation of this parameter\n\n        Returns:\n            - dict representing this parameter\n        \"\"\"\n        return prefect.serialization.task.ParameterSchema().dump(self)\n\n\nclass DateTimeParameter(Parameter):\n    \"\"\"\n    A DateTimeParameter that casts its input as a DateTime\n\n    Args:\n        - name (str): the Parameter name.\n        - default (any, optional): A default value for the parameter. Must be a JSON-Serializable type,\n            and must be parseable by pendulum.\n        - required (bool, optional): If True, the Parameter is required. Otherwise, it\n            is optional and will return `None` if no value is provided.\n        - tags ([str], optional): A list of tags for this parameter\n    \"\"\"\n\n    def __init__(\n        self,\n        name: str,\n        default: JSONSerializableParameterValue = no_default,\n        required: bool = True,\n        tags: Iterable[str] = None,\n    ) -> None:\n        super().__init__(name=name, default=default, required=required, tags=tags)\n        self.result = PrefectResult(serializer=DateTimeSerializer())\n\n    def run(self) -> Any:\n        value = super().run()\n        if value is None:\n            return value\n        elif isinstance(value, str):\n            return pendulum.parse(value)\n        else:\n            return pendulum.instance(value)\n", "path": "src/prefect/core/parameter.py"}]}