[pdm-devel] [PATCH yew-comp 1/7] tasks: make date filter functional

Thomas Lamprecht t.lamprecht at proxmox.com
Tue Jan 21 09:33:40 CET 2025


Am 20.01.25 um 13:10 schrieb Dominik Csapak:
> On 1/20/25 12:30, Thomas Lamprecht wrote:
>> Am 20.01.25 um 10:29 schrieb Dominik Csapak:
>>> +            let since = (since.get_time() / 1000.0).round() as u64;
>>
>> Is round doing something here? Could only be the case if one could enter
>> milliseconds in the since/until strings, and if that would be the case
>> it might be better to just call set_milliseconds(0) too.
> 
> We currently rely on the browser to display a date time selector, and since
> this is browser dependent, we technically cannot really know what we're getting here.
> 
> so the round was just to be overly careful to respect the input, but yeah
> simply omitting the round to truncate the decimal places seems better.
> 
> and 'f64 as u64' already does rounds to zero, so i'll send a follow up to remove the round()

Alternatively one could use .trunc() then I guess, albeit rounding towards zero
should be actually already do exactly the same thing I think.

> to reference the offical rust docs for 'as':
> https://doc.rust-lang.org/1.84.0/reference/expressions/operator-expr.html#type-cast-expressions

Thanks for looking this actually up!




More information about the pdm-devel mailing list