- iOS/Objective-C 元类和类别
- objective-c - -1001 错误,当 NSURLSession 通过 httpproxy 和/etc/hosts
- java - 使用网络类获取 url 地址
- ios - 推送通知中不播放声音
我正在尝试使用 airbnb react-dates使用非英语语言环境(波斯语)并且一切正常,除了本月的第一天。
月份不是从波斯(Jalaali)日历的第一天开始到第 30 天,而是从该月的第 10 天开始,一直持续到下个月的第 10 天。
这个问题甚至存在于他们的example .我想知道有没有什么办法可以解决这个问题。
最佳答案
我一直在一个项目中处理这个问题,这个问题目前是 airbnb react-dates 中的一个开放问题。为了解决这个问题,我 fork 了原始项目,以便它与 jalali moment 一起工作,月份从正确的日期开始,github 和 npm 存储库的链接是:
使用方法:
从 'moment-jalaali' 导入 momentJalali
在要使用日期选择器的组件的构造函数中设置适当的语言环境:
momentJalali.locale('fa')
从 fork 的存储库导入日期选择器:
从“react-dates-jalali”导入 {SingleDatePicker,DateRangePicker};
在渲染部分按以下方式使用 singdatepicker:
<SingleDatePicker
date={date} //momentDate if you have not set this property,it automatically sets to today
focused={this.onFocusChange}//function change focused:open-close
onFocusChange={.../function}
showClearDate={true}
required={true}
isRTL={true}
monthFormat={monthFormat}//for persian:'jMMMM jYYYY', for english :'MMMM YYYY'
onDateChange={this.onDateChange}//function set your date Change
/>
在渲染部分按以下方式使用 daterangepicker:
<DateRangePicker
startDate={startDate} //moment startDate if you have not set this property,it automatically sets to today
endDate={endDate} //moment endDate
onFocusChange={.../function}
required={true}
isRTL={true}
onDatesChange={this.onDatesChange}//function set startDate and endDate
focusedInput={focusedInput}//similar to airbnb api-open\close
showClearDates={true}
monthFormat={monthFormat}//for persian:'jMMMM jYYYY', for english :'MMMM YYYY'
/>
不用说,此存储库支持此处未提及的所有其他 airbnb react-dates api。
如果您的网站是多语言的,您也可以使用此存储库,并且您可以随时更改语言环境和月份格式。
关于javascript - Airbnb react-dates calendar with non-English locale,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48595519/
我正在开发一个程序,可以将星球大战中的自然英语转换为尤达风格的英语。单个句子转换看起来不错,但当涉及多个句子时我遇到了问题。这是我的代码。 public class Yodify{ publi
是否有任何正则表达式模式可以改变这个字符串 This is a mix string of üößñ and English. üößñ üößñ are Unicode words. 为了这个? T
我打算发布一个社区网站,该网站的主要受众不是英语。这意味着指向/profile/forums 等的 URL 将是英文的,而不是他们的母语。我不关心用户是否在访问不同的英文 URL 路径时使用该网站,但
我正在处理包含英文和中文字符的字符串。我想挑出每个英语单词、非英语字符,例如法语、中文等,数字和特殊字符,例如“@#$%^&>?”以便进一步操作。 所以我累了 var nregex = /[^\u00
我在 Android-Chrome 上使用语音合成 API。问题是尽管有 4 种英语语音可用,但无论代码指定什么,浏览器始终使用美国英语。我可以使用其他语言,例如法语,而不是其他英语语音,例如 en-
我在英国,我有一个在英国购买的 Windows 7 版本,我可能找到的所有设置都设置为英国(而非美国)。当我运行以下代码时: Console.WriteLine(Thread.CurrentThrea
我在 MySQL 数据库表中有一个文本字段,其文本值混合了英文和非英文条目(假定以字母开头的字符串被视为英文)。 我想对值进行排序并在 HTML 下拉框中使用它。数据示例: Banana Apple
我有一个 html 如下 pomme English
我需要在 Android 设备中选择当前语言。当我使用以下代码时: Log.v("Language: ", Locale.getDefault().getDisplayLanguage()); Log
快速提问:我需要允许输入只接受从 a 到 z 和从 A 到 Z 的字母,但找不到任何表达式。我想使用 javascript test() 方法。 最佳答案 let res = /^[a-zA-Z]+$
我有一个字符串,其中可能使用了多种语言,例如: این متن فارسی است and this is !!! in English این خط بعدی است و this is going
我只是在使用这个最有用的链接:How do I check if a given string is a legal / valid file name under Windows? 在一些验证代码中
我喜欢加入一个数组,生成一个“英文列表”。例如 ['one', 'two', 'three'] 的结果应该是 'one, 2 and three'。 我写了这段代码来实现的(假设数组不为空,我的情况不
您好,请问有人可以将以下代码行翻译成英文吗? "foo".TrimEnd(New Char(0 - 1) {}) 我知道 TrimEnd 会做什么,但不知道 Char 位。 最佳答案 您发布的代码在
关闭。这个问题需要多问focused 。目前不接受答案。 已关闭10 年前。 已锁定。这个问题及其答案是locked因为这个问题是题外话,但却具有历史意义。目前不接受新的答案或互动。 有人可以用简单的
我正在尝试从Common Crawl阅读“英语”网页。我正在Amazon界面中运行这些Hadoop作业。请看下面的代码,那是Mapper的一部分。我没有 reducer 。 #!/usr/bin/ph
我是 scala 的新手,这更像是一个好奇的问题。 假设我有一个类 class Container() { def add(item: Item) ... } 我可以这样调用它:contain
{ "Actor": { "knownlanguages": [ "English" ] } } 此 JSON 存储在 MySQL 的 JSON columntyp
我有一个遗留类,其中包含 toLowerCase( Locale.ENGLISH ) 当我在客户端使用这个类时,我得到 [ERROR] [onboardingtool] Line 37: The me
我发现我可以应用属性 direction: rtl 来强制从右到左对齐: https://www.w3.org/International/questions/qa-html-dir 它还提到 HTM
我是一名优秀的程序员,十分优秀!