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

Dominik Csapak d.csapak at proxmox.com
Tue Jan 21 10:46:19 CET 2025


On 1/21/25 09:33, Thomas Lamprecht wrote:
> 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!

i already sent a patch for this on yew-devel (since it's not related to pdm):

https://lore.proxmox.com/yew-devel/20250120124146.2952068-1-d.csapak@proxmox.com/

without truncate (just the type casting)

please let me know if that's enough or if you'd prefer a manual truncate




More information about the pdm-devel mailing list