Skip to content

Display custom date format not supported by moment in datepicker #2236

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
1 task done
XcrossD opened this issue May 13, 2020 · 1 comment
Closed
1 task done

Display custom date format not supported by moment in datepicker #2236

XcrossD opened this issue May 13, 2020 · 1 comment
Labels

Comments

@XcrossD
Copy link
Contributor

XcrossD commented May 13, 2020

  • I have searched the issues of this repository and believe that this is not a duplicate.

What problem does this feature solve?

I'm trying to implement lunar calendar with datepicker, but obviously moment does not support the formatting of lunar calendar dates. It would be great to accept a function to render custom date strings in the input, instead of relying on moment.format().

Example: 2020-05-13 turns into 庚子年(鼠)四月廿一

Please suggest other possible solutions if this proposal is not considered. However, seeing that we could customize date cells with the dateRender option I think it makes sense to also allow more flexibility for the date string format in input.

What does the proposed API look like?

<template>
  <a-date-picker
    v-model="value"
    :format="customFormat"
  >

  </a-date-picker>
</template>

<script>
  export default {
    data() {
      return {
        value: null,
      }
    },
    methods: {
      customFormat(value) {
        return getLunarDateString(value); // custom implementation to get lunar calendar date
      }
    }
  };
</script>
@github-actions
Copy link

github-actions bot commented Nov 2, 2021

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Nov 2, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

2 participants