Files
divkit/test_data/expression_test_data/functions_datetime_format.json
pkurchatov a38f24dacb Fixed locale specific expression tests
58eed909f5d83f8391f2ae5b034f031b224159df
2024-06-27 12:14:14 +03:00

245 lines
5.8 KiB
JSON

{
"cases": [
{
"expression": "@{formatDateAsUTC(addMillis(parseUnixTime(3933296), 789), 'dd/MM/yyyy HH:mm:ss.SSS')}",
"expected": {
"type": "string",
"value": "15/02/1970 12:34:56.789"
},
"platforms": [
"android",
"ios",
"web"
]
},
{
"expression": "@{formatDateAsUTC(parseUnixTime(3933296), 'ddd/MM/yy HHH:mmm:sss')}",
"expected": {
"type": "string",
"value": "015/02/70 012:034:056"
},
"platforms": [
"android",
"ios",
"web"
]
},
{
"expression": "@{formatDateAsUTC(parseUnixTime(3933296), '\\'Year \\'y\\', month \\'M\\', day \\'d')}",
"expected": {
"type": "string",
"value": "Year 1970, month 2, day 15"
},
"platforms": [
"android",
"ios",
"web"
]
},
{
"expression": "@{formatDateAsUTCWithLocale(parseUnixTime(3933296), 'E, MMM d, y', 'en-US')}",
"expected": {
"type": "string",
"value": "Sun, Feb 15, 1970"
},
"platforms": [
"android",
"ios",
"web"
]
},
{
"expression": "@{formatDateAsUTCWithLocale(parseUnixTime(3933296), 'EEEE, MMMM d, y', 'en-US')}",
"expected": {
"type": "string",
"value": "Sunday, February 15, 1970"
},
"platforms": [
"android",
"ios",
"web"
]
},
{
"expression": "@{formatDateAsUTCWithLocale(parseUnixTime(7200), 'K:mm a', 'en-US')}",
"expected": {
"type": "string",
"value": "2:00 AM"
},
"platforms": [
"android",
"ios",
"web"
]
},
{
"expression": "@{formatDateAsUTCWithLocale(parseUnixTime(3936896), 'K:mm a', 'en-US')}",
"expected": {
"type": "string",
"value": "1:34 PM"
},
"platforms": [
"android",
"ios",
"web"
]
},
{
"expression": "@{formatDateAsUTCWithLocale(parseUnixTime(0), 'yyyy G', 'en-US')}",
"expected": {
"type": "string",
"value": "1970 AD"
},
"platforms": [
"android",
"ios",
"web"
]
},
{
"expression": "@{formatDateAsUTCWithLocale(setDay(parseUnixTime(0), 13), 'yyyy-MM-dd\\'T\\'HH:mm:ss.SSS', 'en-US')}",
"expected": {
"type": "string",
"value": "1970-01-13T00:00:00.000"
},
"platforms": [
"android",
"ios",
"web"
]
},
{
"expression": "@{formatDateAsUTCWithLocale(parseUnixTime(3927600), 'yyyy-MM-dd\\', week of year \\'w', 'en-US')}",
"expected": {
"type": "string",
"value": "1970-02-15, week of year 8"
},
"platforms": [
"android",
"ios",
"web"
]
},
{
"expression": "@{formatDateAsUTCWithLocale(parseUnixTime(3927600), 'yyyy-MM-dd\\', week of year \\'w', 'ru-RU')}",
"platform_specific": {
"web": {
"weekStartDay": 1
}
},
"expected": {
"type": "string",
"value": "1970-02-15, week of year 7"
},
"platforms": [
"android",
"ios",
"web"
]
},
{
"expression": "@{formatDateAsUTCWithLocale(parseUnixTime(3927600), 'yyyy-MM-dd\\', week of month \\'W', 'en-US')}",
"expected": {
"type": "string",
"value": "1970-02-15, week of month 3"
},
"platforms": [
"android",
"ios",
"web"
]
},
{
"expression": "@{formatDateAsUTC(parseUnixTime(0), '\\'Year \\'y\\', extended year \\'u')}",
"expected": {
"type": "string",
"value": "Year 1970, extended year 1970"
},
"platforms": [
"ios",
"web"
]
},
{
"expression": "@{toLowerCase(formatDateAsUTCWithLocale(parseUnixTime(3933296), 'E, d MMMM y G', 'ru-RU'))}",
"expected": {
"type": "string",
"value": "вс, 15 февраля 1970 н. э."
},
"platforms": [
"android",
"ios",
"web"
]
},
{
"expression": "@{formatDateAsUTC(parseUnixTime(3933240), 'dd/MM/yyyy HH:mm Z')}",
"expected": {
"type": "string",
"value": "15/02/1970 12:34 +0000"
},
"platforms": [
"android",
"ios",
"web"
]
},
{
"expression": "@{formatDateAsUTC(parseUnixTime(3933240), 'dd/MM/yyyy HH:mm z')}",
"unsupported_platforms": {
"ios": "Platform-specific format"
},
"expected": {
"type": "string",
"value": "15/02/1970 12:34 UTC"
},
"platforms": [
"android",
"web"
]
},
{
"expression": "@{formatDateAsUTCWithLocale(parseUnixTime(3933240), 'dd/MM/yyyy HH:mm zzzz', 'en-US')}",
"unsupported_platforms": {
"ios": "Platform-specific format"
},
"expected": {
"type": "string",
"value": "15/02/1970 12:34 Coordinated Universal Time"
},
"platforms": [
"android",
"web"
]
},
{
"expression": "@{formatDateAsUTC(parseUnixTime(3933240), 'dd/MM/yyyy HH:mm z')}",
"unsupported_platforms": {
"web": "Platform-specific format",
"android": "Platform-specific format"
},
"expected": {
"type": "string",
"value": "15/02/1970 12:34 GMT"
},
"platforms": [
"ios"
]
},
{
"expression": "@{formatDateAsUTCWithLocale(parseUnixTime(3933240), 'dd/MM/yyyy HH:mm zzzz', 'en-US')}",
"unsupported_platforms": {
"web": "Platform-specific format",
"android": "Platform-specific format"
},
"expected": {
"type": "string",
"value": "15/02/1970 12:34 Greenwich Mean Time"
},
"platforms": [
"ios"
]
}
]
}