Repository navigation
Refactor formatter samples: move logic to backend, clarify date handling - #703
Merged
Merged
Conversation
Both samples referenced curated formatter functions that no longer exist, so their bindings resolved to nothing: - 450 bound Formatter.weightState, removed as business logic (parseFloat + KG conversion + thresholds). Its subject - wiring the curated module via core:require - is already covered by 457, so it now demonstrates what the other four do not: the ABAP date-string helpers DateAbapDateToDateObject / DateAbapDateTimeToDateObject on the 8/6-char DATS/TIMS forms, including an initial 00000000 rendering empty rather than a wrong 1899 date. (A field typed d/t is serialized as ISO and takes DateCreateObject instead - noted in the class.) - 453 was the "demo kit pack" demo and bound all five functions that were removed for being work ABAP finishes. It now shows the opposite, which is the pattern apps should copy: the same table with the state, icon, rounded price and dimension string computed in products_prepare and bound as plain fields - no core:require, no formatter, no client-side logic. Descriptions and the generated overview catalog updated accordingly; abaplint clean on both the standard and the 702 downport. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_012JHCNLVfGJfRFTBwNMntGX
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Restructures two formatter demo samples to better illustrate the separation of concerns between backend and frontend:
Key Changes
Sample 453 (z2ui5_cl_demo_app_453):
weight,pricefromstringto proper types (i,p LENGTH 9 DECIMALS 2)weight_state,price_disp,dimensions,status_icon,status_state,delivery_stateproducts_prepare()method that centralizes all formatting logic:core:requirefor formatter module and all client-side formatter bindingsSample 450 (z2ui5_cl_demo_app_450):
DateAbapDateToDateObjectandDateAbapDateTimeToDateObjectformattersNavigation (z2ui5_cl_demo_app_g00):
Implementation Details
The refactoring demonstrates that business logic (thresholds, domain vocabulary mappings, string composition) belongs in the backend where the data originates, not in client-side formatters. The only conversion that legitimately requires a formatter is ABAP date string → JavaScript Date object, which sample 450 now exclusively showcases.
https://claude.ai/code/session_012JHCNLVfGJfRFTBwNMntGX