Ticket #6081 (new defect)

Opened 2 years ago

Last modified 5 days ago

DateField should zero fields that are not part of the resolution

Reported by: romain.wilbert Owned by:
Priority: normal Milestone: Vaadin 7 backlog
Component: Core Framework Version: 6.4.8
Keywords: Cc: aukevanleeuwen@…
Hours estimate: Hours done:
Depends on:
Workaround:
Pro Account: Mark as Priority

Description (last modified by Artur Signell) (diff)

A DateField with resolution DAY should have hour/minutes/seconds/milliseconds automatically set to 0. With resolution month, DAY should also be reset. The current behavior is most troublesome when initializing a date field (resolution day) with a null value as this causes the date field to use the current hour/minute/second.

Change History

comment:1 Changed 2 years ago by Matti Tahvonen

  • Milestone changed from Vaadin 6.5.0 to IT Mill Sponsored Backlog

cant' do this in 6.5, might change existing apps.

comment:2 follow-up: ↓ 3 Changed 2 years ago by Marko Gronroos

Might not be desirable. It's always possible to truncate the time to the DateField resolution in the user code, but not de-truncate an automatically truncated value.

For example, if you create a custom date+time selector by compositing a DateField with day resolution and a custom time selection component, changing the date should not set the time to 00:00.

comment:3 in reply to: ↑ 2 Changed 2 years ago by auke

  • Cc aukevanleeuwen@… added

Replying to Marko Gronroos:

Might not be desirable. It's always possible to truncate the time to the DateField resolution in the user code, but not de-truncate an automatically truncated value.

For example, if you create a custom date+time selector by compositing a DateField with day resolution and a custom time selection component, changing the date should not set the time to 00:00.

In which case it is still desireable, since you've created two components the combined field is responsible for setting the correct time (from the custom time component) on the java.util.Date. So the DateField still only needs to give back the truncated date.

comment:4 Changed 18 months ago by Artur Signell

  • Status changed from new to accepted
  • Owner changed from ticketmaster to Artur Signell
  • Milestone changed from Vaadin Backlog to Vaadin 7.0.0.alpha1

I don't see the reason for not zeroing it but doing it to 7.0 as it might break apps.

comment:5 Changed 18 months ago by Artur Signell

  • Description modified (diff)
  • Summary changed from DateField with DAY resolution should set time to zero to DateField should zero fields that are not part of the resolution

comment:6 Changed 17 months ago by Artur Signell

  • Milestone changed from Vaadin 7.0.0.alpha1 to Vaadin 7.0.0.alpha2

Ended up only zeroing only the unused parts when there is no value for now, i.e. when doing new DateField() and not setting a value. Will need to reconsider still if setValue(Date date) should remove parts that are outside the scope of the resolution. It could be unwanted if you are using time zones and/or showing only the d/m/y part of a Date. Maybe it should be an option.

comment:7 Changed 15 months ago by Artur Signell

  • Milestone changed from Vaadin 7.0.0.alpha2 to Vaadin 7 backlog

comment:8 Changed 7 months ago by Artur Signell

  • Owner Artur Signell deleted
  • Status changed from accepted to new

comment:9 Changed 5 days ago by Artur Signell

  • Component changed from Component to Core Framework
Note: See TracTickets for help on using tickets.