mirror of
https://repo.dactyloidae.xyz/Dactyloidae/UXP.git
synced 2026-09-29 11:57:32 +09:00
Support Unicode White Spaces in ParseDate()
This commit is contained in:
parent
45e476f332
commit
501a90aad3
1 changed files with 13 additions and 1 deletions
|
|
@ -36,6 +36,7 @@
|
||||||
|
|
||||||
#include "js/Conversions.h"
|
#include "js/Conversions.h"
|
||||||
#include "js/Date.h"
|
#include "js/Date.h"
|
||||||
|
#include "unicode/uchar.h"
|
||||||
#include "vm/DateTime.h"
|
#include "vm/DateTime.h"
|
||||||
#include "vm/GlobalObject.h"
|
#include "vm/GlobalObject.h"
|
||||||
#include "vm/Interpreter.h"
|
#include "vm/Interpreter.h"
|
||||||
|
|
@ -962,6 +963,12 @@ ParseDate(const CharT* s, size_t length, ClippedTime* result)
|
||||||
int c = s[i];
|
int c = s[i];
|
||||||
i++;
|
i++;
|
||||||
|
|
||||||
|
// CLDR 42 has opened the door to whitespace,
|
||||||
|
// so let's normalize them all to standard spaces.
|
||||||
|
if (u_hasBinaryProperty(static_cast<UChar32>(c), UCHAR_WHITE_SPACE)) {
|
||||||
|
c = ' ';
|
||||||
|
}
|
||||||
|
|
||||||
// Spaces, ASCII control characters, and commas are ignored.
|
// Spaces, ASCII control characters, and commas are ignored.
|
||||||
if (c <= ' ' || c == ',')
|
if (c <= ' ' || c == ',')
|
||||||
continue;
|
continue;
|
||||||
|
|
@ -998,6 +1005,11 @@ ParseDate(const CharT* s, size_t length, ClippedTime* result)
|
||||||
i++;
|
i++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// CLDR 42 reprise.
|
||||||
|
if (u_hasBinaryProperty(static_cast<UChar32>(c), UCHAR_WHITE_SPACE)) {
|
||||||
|
c = ' ';
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Allow TZA before the year, so 'Wed Nov 05 21:49:11 GMT-0800 1997'
|
* Allow TZA before the year, so 'Wed Nov 05 21:49:11 GMT-0800 1997'
|
||||||
* works.
|
* works.
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue