Skip to Content
avatar image
Former Member

Datepicker pattern from Model

Hi!

How can I define a pattern dynamic from a model?

For example I have this DatePicker:

The value off STORE_VAL_DATE_FROM is "20160724"

<DatePicker
                                value="{
                                    path:'STORE_VAL_DATE_FROM',
                                    type: 'sap.ui.model.type.Date',
                                    formatOptions:{
                                        source: {
                                            pattern: 'yyyyMMdd'
                                        },
                                        pattern: 'dd/MM/yyyy'
                                    }
                                }"
                            />

This works OK!

I want the pattern (dd/MM/yyyy) to be dynamic.

I Tried this but no works:

The value /USERINFO/USER_DATE_FORMAT is "dd/MM/yyyy"

<DatePicker
                                value="{
                                    path:'STORE_VAL_DATE_FROM',
                                    type: 'sap.ui.model.type.Date',
                                    formatOptions:{
                                        source: {
                                            pattern: 'yyyyMMdd'
                                        },
                                        pattern: '/USERINFO/USER_DATE_FORMAT'
                                    }
                                }"
                            />

How can I resolve this?

Thanks

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

1 Answer

  • Dec 13, 2016 at 03:14 PM

    Hi Puig,

    I think pattern allows only the date patterns like "mmddyyyy" or "dd/mm/yyyy"

    I am expecting that u can't use like this

    pattern:'/USERINFO/USER_DATE_FORMAT'
    
    

    Thanks,

    Deepak.

    Add comment
    10|10000 characters needed characters exceeded