Skip to content

Commit

Permalink
chore(trans): remove unused WeblateDateField
Browse files Browse the repository at this point in the history
This is followup for #11894.
  • Loading branch information
nijel committed Jun 19, 2024
1 parent ed2a567 commit d59795d
Showing 1 changed file with 1 addition and 17 deletions.
18 changes: 1 addition & 17 deletions weblate/trans/forms.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
import copy
import json
import re
from datetime import date, datetime, timedelta
from datetime import datetime, timedelta
from secrets import token_hex

from crispy_forms.bootstrap import InlineCheckboxes, InlineRadios, Tab, TabHolder
Expand Down Expand Up @@ -117,22 +117,6 @@ class WeblateDateInput(forms.DateInput):
input_type = "date"


class WeblateDateField(forms.DateField):
def __init__(self, **kwargs) -> None:
if "widget" not in kwargs:
kwargs["widget"] = WeblateDateInput
super().__init__(**kwargs)

def to_python(self, value):
"""Produce timezone-aware datetime with 00:00:00 as time."""
value = super().to_python(value)
if isinstance(value, date):
return from_current_timezone(
datetime(value.year, value.month, value.day, 0, 0, 0) # noqa: DTZ001
)
return value


class DateRangeField(forms.CharField):
"""Field for a date range input."""

Expand Down

0 comments on commit d59795d

Please sign in to comment.